[PATCH] D151190: [clangd] Do not end inactiveRegions range at position 0 of line

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 29 22:24:03 PDT 2023


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:119
         if (CollectInactiveRegions) {
-          ServerCallbacks->onInactiveRegionsReady(
-              Path, std::move(AST.getMacros().SkippedRanges));
+          std::vector<Range> SkippedRanges(
+              std::move(AST.getMacros().SkippedRanges));
----------------
this part of code becomes non-trivial now, I suggest pulling out a function and moving it to `SemanticHighlighting.cpp`. The old inactive-as-comment implementation can share it as well.


================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:153
+          }
+          ServerCallbacks->onInactiveRegionsReady(Path, InactiveRegions);
         }
----------------
nit: std::move(InactiveRegions).


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:478
       for (int Line = R.start.line; Line <= R.end.line; ++Line) {
         // If the end of the inactive range is at the beginning
         // of a line, that line is not inactive.
----------------
I think we should do the same thing for the old implementation as well (or just delete it at all), otherwise, we will have inconsistent behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151190



More information about the cfe-commits mailing list