sammccall added inline comments.

================
Comment at: clang-tools-extra/clangd/XRefs.cpp:654
+  // Types of control-flow statements we might highlight.
+  enum Target {
+    Break = 1,
----------------
adamcz wrote:
> What about "goto"? It's more difficult to figure out if it breaks out of the 
> loop or just jumps inside it, but it might still be worth highlighting it, 
> even unconditionally (inside a loop only, not function).
I think I worked out the right logic for where it jumps based on `Bounds` 
(which we now always compute).

Selecting the goto statement itself isn't handled here, it should be handled as 
a "regular" reference to the labeldecl. (But isn't yet).


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:119
 
+TEST(HighlightsTest, ControlFlow) {
+  const char *Tests[] = {
----------------
adamcz wrote:
> Can you add a test for macros? I think highlighting like ASSIGN_OR_RETURN(int 
> x, foo()); would be great, but even if we don't support that, just having a 
> test that we don't crash would be valuable, IMHO.
Changed the sourcelocation handling to enable macros.
Now if the relevant keyword is expanded from a macro body, the macro name will 
he highlighted. If it's expanded from a macro arg, the arg will still be 
highlighted.
Added a test for both.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78454/new/

https://reviews.llvm.org/D78454



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to