Skip to content

Commit 9cd30b1

Browse files
authored
Fix the sort function for languages to have "strict weak ordering". (#114160)
If you build libstdc++ with "debug" strictness, the test TestTypeLookup.py will assert. That's because we're calling llvm::sort (which redirects to std::sort) with a function that doesn't obey strict weak ordering. The error was that when the two languages were equal, we're sometimes returning `true` but strict weak ordering requires that always be false. This patch just makes the function behave properly.
1 parent a575e6e commit 9cd30b1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lldb/source/Commands/CommandObjectType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,8 @@ class CommandObjectTypeLookup : public CommandObjectRaw {
26492649
return false;
26502650
LanguageType lt1 = lang1->GetLanguageType();
26512651
LanguageType lt2 = lang2->GetLanguageType();
2652+
if (lt1 == lt2)
2653+
return false;
26522654
if (lt1 == guessed_language)
26532655
return true; // make the selected frame's language come first
26542656
if (lt2 == guessed_language)

0 commit comments

Comments
 (0)