[clang] [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (PR #93926)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 23:44:45 PDT 2024
================
@@ -855,10 +855,14 @@ bool RecursiveASTVisitor<Derived>::TraverseDeclarationNameInfo(
template <typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseTemplateName(TemplateName Template) {
- if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
+ if (DependentTemplateName *DTN = Template.getAsDependentTemplateName()) {
TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
- else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
- TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+ } else if (QualifiedTemplateName *QTN =
+ Template.getAsQualifiedTemplateName()) {
+ if (QTN->getQualifier()) {
+ TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+ }
+ }
----------------
cor3ntin wrote:
```suggestion
} else if (QualifiedTemplateName *QTN =
Template.getAsQualifiedTemplateName(); QTN && QTN->getQualifier()) {
TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
}
```
https://github.com/llvm/llvm-project/pull/93926
More information about the cfe-commits
mailing list