[clang] [Clang][AST] Fix ExplicitInstantiationDecl accessors for variable templates with tag types (PR #197856)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 21:12:22 PDT 2026
================
@@ -3449,9 +3449,19 @@ class ExplicitInstantiationDecl final
return hasTrailingQualifier() ? 1 : 0;
}
- /// Raw access to the internal TypeSourceInfo. For class templates this is
- /// a TemplateSpecializationTypeLoc; for nested classes a TagTypeLoc.
- /// Public getTypeAsWritten() returns null for those cases.
+ /// For class templates / nested classes, returns the TypeLoc encoding the
+ /// entity (TemplateSpecializationTypeLoc or TagTypeLoc). For function /
+ /// variable templates -- where TypeSourceInfo holds the declared type
+ /// rather than the entity -- returns std::nullopt.
+ std::optional<TypeLoc> getClassTypeLoc() const {
----------------
zwuis wrote:
Can we return default-constructed `TypeLoc` instead of `std::nullopt`?
https://github.com/llvm/llvm-project/pull/197856
More information about the cfe-commits
mailing list