[clang] [clang-tools-extra] [Clang][AST] Introduce `ExplicitInstantiationDecl` to preserve source info and fix diagnostic locations (PR #191658)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 09:25:49 PDT 2026


================
@@ -1748,6 +1748,15 @@ DEF_TRAVERSE_DECL(StaticAssertDecl, {
   TRY_TO(TraverseStmt(D->getMessage()));
 })
 
+DEF_TRAVERSE_DECL(ExplicitInstantiationDecl, {
+  if (D->getQualifierLoc())
+    TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
+  for (unsigned I = 0, E = D->getNumTemplateArgs(); I != E; ++I)
+    TRY_TO(TraverseTemplateArgumentLoc(D->getTemplateArg(I)));
+  if (TypeSourceInfo *TSI = D->getTypeAsWritten())
+    TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
+})
----------------
mizvekov wrote:

Ditto. Also, when the Qualifier comes from the TSI, are you sure this is not double visiting?

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


More information about the cfe-commits mailing list