[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf4ba7a100a56: [clangd] Semantic highlighting for dependent template name in template argument (authored by nridge). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85272/new/ https://reviews.llvm.org/D85272 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 @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,18 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default: + break; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp === --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,18 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default: + break; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
nridge marked an inline comment as done. nridge added inline comments. Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:305 + break; +default:; +} nridge wrote: > hokein wrote: > > nit: move the trailing `;` to a new line. > I have done this, but clang-format moves it back... do we really want to > fight wit it? I wrote it as: ``` default: break; ``` instead, I think that may be more idiomatic anyways. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85272/new/ https://reviews.llvm.org/D85272 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
nridge updated this revision to Diff 283784. nridge added a comment. Address nit Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85272/new/ https://reviews.llvm.org/D85272 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 @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,18 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default: + break; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp === --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,18 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default: + break; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
nridge added inline comments. Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:305 + break; +default:; +} hokein wrote: > nit: move the trailing `;` to a new line. I have done this, but clang-format moves it back... do we really want to fight wit it? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85272/new/ https://reviews.llvm.org/D85272 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
hokein accepted this revision. hokein added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:305 + break; +default:; +} nit: move the trailing `;` to a new line. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85272/new/ https://reviews.llvm.org/D85272 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85272: [clangd] Semantic highlighting for dependent template name in template argument
nridge created this revision. Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous. Herald added a project: clang. nridge requested review of this revision. Herald added subscribers: MaskRay, ilya-biryukov. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85272 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 @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,17 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default:; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp === --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -686,6 +686,14 @@ void $Function[[bar]]($TemplateParameter[[T]] $Parameter[[F]]) { $Parameter[[F]].$DependentName[[foo]](); } +)cpp", + // Dependent template name + R"cpp( + template class> struct $Class[[A]] {}; + template + using $Typedef[[W]] = $Class[[A]]< +$TemplateParameter[[T]]::template $DependentType[[Waldo]] + >; )cpp"}; for (const auto : TestCases) { checkHighlightings(TestCase); Index: clang-tools-extra/clangd/SemanticHighlighting.cpp === --- clang-tools-extra/clangd/SemanticHighlighting.cpp +++ clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -296,6 +296,17 @@ return true; } + bool TraverseTemplateArgumentLoc(TemplateArgumentLoc L) { +switch (L.getArgument().getKind()) { +case TemplateArgument::Template: +case TemplateArgument::TemplateExpansion: + H.addToken(L.getTemplateNameLoc(), HighlightingKind::DependentType); + break; +default:; +} +return RecursiveASTVisitor::TraverseTemplateArgumentLoc(L); + } + // findExplicitReferences will walk nested-name-specifiers and // find anything that can be resolved to a Decl. However, non-leaf // components of nested-name-specifiers which are dependent names ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits