[PATCH] D78454: [clangd] Highlight related control flow.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 18 15:45:13 PDT 2020
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
More information about the cfe-commits
mailing list