ckandeler updated this revision to Diff 453648. ckandeler added a comment. Use variable instead of macro.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131175/new/ https://reviews.llvm.org/D131175 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 @@ -841,6 +841,12 @@ $Function_deprecated[[Foo]]($Parameter[[x]]); } )cpp", + // Predefined identifiers + R"cpp( + void $Function_decl[[Foo]]() { + const char *$LocalVariable_decl_readonly[[s]] = $LocalVariable_readonly_static[[__func__]]; + } + )cpp", // Explicit template specialization R"cpp( struct $Class_decl[[Base]]{}; Index: clang-tools-extra/clangd/SemanticHighlighting.cpp =================================================================== --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -542,6 +542,14 @@ return Base::TraverseConstructorInitializer(Init); } + bool VisitPredefinedExpr(PredefinedExpr *E) { + H.addToken(E->getLocation(), HighlightingKind::LocalVariable) + .addModifier(HighlightingModifier::Static) + .addModifier(HighlightingModifier::Readonly) + .addModifier(HighlightingModifier::FunctionScope); + return true; + } + bool VisitCallExpr(CallExpr *E) { // Highlighting parameters passed by non-const reference does not really // make sense for literals...
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -841,6 +841,12 @@ $Function_deprecated[[Foo]]($Parameter[[x]]); } )cpp", + // Predefined identifiers + R"cpp( + void $Function_decl[[Foo]]() { + const char *$LocalVariable_decl_readonly[[s]] = $LocalVariable_readonly_static[[__func__]]; + } + )cpp", // Explicit template specialization R"cpp( struct $Class_decl[[Base]]{}; Index: clang-tools-extra/clangd/SemanticHighlighting.cpp =================================================================== --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -542,6 +542,14 @@ return Base::TraverseConstructorInitializer(Init); } + bool VisitPredefinedExpr(PredefinedExpr *E) { + H.addToken(E->getLocation(), HighlightingKind::LocalVariable) + .addModifier(HighlightingModifier::Static) + .addModifier(HighlightingModifier::Readonly) + .addModifier(HighlightingModifier::FunctionScope); + return true; + } + bool VisitCallExpr(CallExpr *E) { // Highlighting parameters passed by non-const reference does not really // make sense for literals...
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits