[IDE] Fix sort predicate in printCodeCompletionLookedupTypeNames

This wasn't a strict weak ordering, and it turns out violating that
is undefined behavior which can result in buffer overruns.
This commit is contained in:
Hamish Knight
2025-07-07 22:33:35 +01:00
parent ed3961bcd5
commit adbbb9e3cd
4 changed files with 10 additions and 6 deletions

View File

@@ -1379,7 +1379,7 @@ printCodeCompletionLookedupTypeNames(ArrayRef<NullTerminatedStringRef> names,
sortedNames.append(names.begin(), names.end());
llvm::sort(sortedNames,
[](NullTerminatedStringRef a, NullTerminatedStringRef b) {
return a.compare(b) <= 0;
return a.compare(b) < 0;
});
OS << "LookedupTypeNames: [";