diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp index 862cfc8edf0aa..fce83d1834a50 100644 --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -912,7 +912,7 @@ bool operator==(const HighlightingToken &L, const HighlightingToken &R) { std::tie(R.R, R.Kind, R.Modifiers); } bool operator<(const HighlightingToken &L, const HighlightingToken &R) { - return std::tie(L.R, L.Kind, R.Modifiers) < + return std::tie(L.R, L.Kind, L.Modifiers) < std::tie(R.R, R.Kind, R.Modifiers); } diff --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp index 210bc7736cdd0..2f4e8e57a81f1 100644 --- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -795,7 +795,19 @@ sizeof...($TemplateParameter[[Elements]]); typedef int $Primitive_decl[[MyTypedef]]; enum $Enum_decl[[MyEnum]] : $Primitive[[MyTypedef]] {}; )cpp", - }; + // Issue 1096 + R"cpp( + void $Function_decl[[Foo]](); + // Use <: :> digraphs for deprecated attribute to avoid conflict with annotation syntax + <:<:deprecated:>:> void $Function_decl_deprecated[[Foo]](int* $Parameter_decl[[x]]); + void $Function_decl[[Foo]](int $Parameter_decl[[x]]); + template + void $Function_decl[[Bar]]($TemplateParameter[[T]] $Parameter_decl[[x]]) { + $Function_deprecated[[Foo]]($Parameter[[x]]); + $Function_deprecated[[Foo]]($Parameter[[x]]); + $Function_deprecated[[Foo]]($Parameter[[x]]); + } + )cpp"}; for (const auto &TestCase : TestCases) // Mask off scope modifiers to keep the tests manageable. // They're tested separately.