[PATCH] D146733: [clang] source range of variable template specialization should include initializer
Tomasz KamiĆski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 23 09:56:44 PDT 2023
tomasz-kaminski-sonarsource added a comment.
I have updated the description and implementation. Will look at adding a unit test tomorrow.
================
Comment at: clang/lib/AST/DeclTemplate.cpp:1467
+SourceRange VarTemplatePartialSpecializationDecl::getSourceRange() const {
+ if (const Expr *Init = getInit()) {
+ SourceLocation InitEnd = Init->getEndLoc();
----------------
erichkeane wrote:
> Looking closer... VarDecl already includes its init in its source range, right? So perhaps all that needs to happen here is to have the `isExplicitSpecialization` check be :
>
> `isExplicitSpecialization() && !hasInit()`
>
> WDYT?
Great suggestion. I really disliked the repetition.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146733/new/
https://reviews.llvm.org/D146733
More information about the cfe-commits
mailing list