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

via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 22:56:50 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)

<details>
<summary>Changes</summary>

This change was missed in #<!-- -->93433.

---
Full diff: https://github.com/llvm/llvm-project/pull/93926.diff


1 Files Affected:

- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+6-3) 


``````````diff
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4bbb4380cdd7f..28a90dffcb8dc 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -855,10 +855,13 @@ 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 (T->getQualifier()) {
+      TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
+    }
+  }
 
   return true;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/93926


More information about the cfe-commits mailing list