[clang] [Clang][AST] Fix ExplicitInstantiationDecl accessors for variable templates with tag types (PR #197856)
via cfe-commits
cfe-commits at lists.llvm.org
Sat May 16 09:22:07 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 {
----------------
16bit-ykiko wrote:
I think `std::optional` is clearer.
https://github.com/llvm/llvm-project/pull/197856
More information about the cfe-commits
mailing list