[clang] be566d2 - [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (#93926)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 00:31:35 PDT 2024


Author: Matheus Izvekov
Date: 2024-05-31T04:31:31-03:00
New Revision: be566d2eacdaed972b90d2eeb1e66d732c9fe7c1

URL: https://github.com/llvm/llvm-project/commit/be566d2eacdaed972b90d2eeb1e66d732c9fe7c1
DIFF: https://github.com/llvm/llvm-project/commit/be566d2eacdaed972b90d2eeb1e66d732c9fe7c1.diff

LOG: [clang] AST Visitor: skip empty qualifiers in QualifiedTemplateName (#93926)

Added: 
    

Modified: 
    clang/include/clang/AST/RecursiveASTVisitor.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4bbb4380cdd7f..99093aa17972c 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -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()));
+    }
+  }
 
   return true;
 }


        


More information about the cfe-commits mailing list