Skip to content

Commit e500062

Browse files
[clangd] Fix incorrect operator< impl for HighlightingToken
Differential Revision: https://reviews.llvm.org/D123478
1 parent 05256c8 commit e500062

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ bool operator==(const HighlightingToken &L, const HighlightingToken &R) {
912912
std::tie(R.R, R.Kind, R.Modifiers);
913913
}
914914
bool operator<(const HighlightingToken &L, const HighlightingToken &R) {
915-
return std::tie(L.R, L.Kind, R.Modifiers) <
915+
return std::tie(L.R, L.Kind, L.Modifiers) <
916916
std::tie(R.R, R.Kind, R.Modifiers);
917917
}
918918

clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,19 @@ sizeof...($TemplateParameter[[Elements]]);
795795
typedef int $Primitive_decl[[MyTypedef]];
796796
enum $Enum_decl[[MyEnum]] : $Primitive[[MyTypedef]] {};
797797
)cpp",
798-
};
798+
// Issue 1096
799+
R"cpp(
800+
void $Function_decl[[Foo]]();
801+
// Use <: :> digraphs for deprecated attribute to avoid conflict with annotation syntax
802+
<:<:deprecated:>:> void $Function_decl_deprecated[[Foo]](int* $Parameter_decl[[x]]);
803+
void $Function_decl[[Foo]](int $Parameter_decl[[x]]);
804+
template <typename $TemplateParameter_decl[[T]]>
805+
void $Function_decl[[Bar]]($TemplateParameter[[T]] $Parameter_decl[[x]]) {
806+
$Function_deprecated[[Foo]]($Parameter[[x]]);
807+
$Function_deprecated[[Foo]]($Parameter[[x]]);
808+
$Function_deprecated[[Foo]]($Parameter[[x]]);
809+
}
810+
)cpp"};
799811
for (const auto &TestCase : TestCases)
800812
// Mask off scope modifiers to keep the tests manageable.
801813
// They're tested separately.

0 commit comments

Comments
 (0)