Skip to content

Commit 237cb04

Browse files
committed
Fix the sort function for languages to have "strict weak ordering".
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 39303e2 commit 237cb04

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lldb/source/Commands/CommandObjectType.cpp

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

0 commit comments

Comments
 (0)