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);
 }
 


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);
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to