This revision was automatically updated to reflect the committed changes. hokein marked an inline comment as done. Closed by commit rGe3ec9dd0ba42: [clangd] Run semantic highligting in clangd check. (authored by hokein).
Changed prior to commit: https://reviews.llvm.org/D137063?vs=471951&id=471989#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137063/new/ https://reviews.llvm.org/D137063 Files: clang-tools-extra/clangd/tool/Check.cpp Index: clang-tools-extra/clangd/tool/Check.cpp =================================================================== --- clang-tools-extra/clangd/tool/Check.cpp +++ clang-tools-extra/clangd/tool/Check.cpp @@ -34,6 +34,7 @@ #include "ParsedAST.h" #include "Preamble.h" #include "Protocol.h" +#include "SemanticHighlighting.h" #include "SourceCode.h" #include "XRefs.h" #include "index/CanonicalIncludes.h" @@ -206,6 +207,14 @@ } } + void buildSemanticHighlighting(llvm::Optional<Range> LineRange) { + log("Building semantic highlighting"); + auto Highlights = getSemanticHighlightings(*AST); + for (const auto HL : Highlights) + if (!LineRange || LineRange->contains(HL.R)) + vlog(" {0} {1} {2}", HL.R, HL.Kind, HL.Modifiers); + } + // Run AST-based features at each token in the file. void testLocationFeatures(llvm::Optional<Range> LineRange, const bool EnableCodeCompletion) { @@ -302,6 +311,7 @@ !C.buildAST()) return false; C.buildInlayHints(LineRange); + C.buildSemanticHighlighting(LineRange); C.testLocationFeatures(LineRange, EnableCodeCompletion); log("All checks completed, {0} errors", C.ErrCount);
Index: clang-tools-extra/clangd/tool/Check.cpp =================================================================== --- clang-tools-extra/clangd/tool/Check.cpp +++ clang-tools-extra/clangd/tool/Check.cpp @@ -34,6 +34,7 @@ #include "ParsedAST.h" #include "Preamble.h" #include "Protocol.h" +#include "SemanticHighlighting.h" #include "SourceCode.h" #include "XRefs.h" #include "index/CanonicalIncludes.h" @@ -206,6 +207,14 @@ } } + void buildSemanticHighlighting(llvm::Optional<Range> LineRange) { + log("Building semantic highlighting"); + auto Highlights = getSemanticHighlightings(*AST); + for (const auto HL : Highlights) + if (!LineRange || LineRange->contains(HL.R)) + vlog(" {0} {1} {2}", HL.R, HL.Kind, HL.Modifiers); + } + // Run AST-based features at each token in the file. void testLocationFeatures(llvm::Optional<Range> LineRange, const bool EnableCodeCompletion) { @@ -302,6 +311,7 @@ !C.buildAST()) return false; C.buildInlayHints(LineRange); + C.buildSemanticHighlighting(LineRange); C.testLocationFeatures(LineRange, EnableCodeCompletion); log("All checks completed, {0} errors", C.ErrCount);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits