[PATCH] D123478: [clangd] Fix incorrect operator< impl for HighlightingToken
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 13 00:18:58 PDT 2022
nridge updated this revision to Diff 422410.
nridge added a comment.
Add semantic highlighting testcase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123478/new/
https://reviews.llvm.org/D123478
Files:
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -797,7 +797,19 @@
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 <typename $TemplateParameter_decl[[T]]>
+ 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.
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===================================================================
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -913,7 +913,7 @@
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123478.422410.patch
Type: text/x-patch
Size: 1772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220413/0ff24d5a/attachment.bin>
More information about the cfe-commits
mailing list