[clang] [clang][AST] Fix assertion in `getFullyQualifiedType` for AutoType (PR #186105)
Harald van Dijk via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 5 03:02:42 PDT 2026
hvdijk wrote:
It turns out that both this and `DecltypeType` are handled already by `getCanonicalType()`, which we call already but then drop its result. If we continue using it, and revert your code changes but keep your tests, those tests pass:
```diff
--- a/clang/lib/Interpreter/InterpreterValuePrinter.cpp
+++ b/clang/lib/Interpreter/InterpreterValuePrinter.cpp
@@ -78,7 +78,7 @@ static std::string QualTypeToString(ASTContext &Ctx, QualType QT) {
!NonRefTy->isMemberPointerType())
return Canon.getAsString(Ctx.getPrintingPolicy());
- if (const auto *TDTy = dyn_cast<TypedefType>(NonRefTy)) {
+ if (const auto *TDTy = dyn_cast<TypedefType>(Canon)) {
// FIXME: TemplateSpecializationType & SubstTemplateTypeParmType checks
// are predominately to get STL containers to print nicer and might be
// better handled in GetFullyQualifiedName.
@@ -90,10 +90,10 @@ static std::string QualTypeToString(ASTContext &Ctx, QualType QT) {
if (llvm::isa<SubstTemplateTypeParmType>(SSDesugar))
return GetFullTypeName(Ctx, Canon);
else if (llvm::isa<TemplateSpecializationType>(SSDesugar))
- return GetFullTypeName(Ctx, NonRefTy);
- return DeclTypeToString(NonRefTy, TDTy->getDecl());
+ return GetFullTypeName(Ctx, Canon);
+ return DeclTypeToString(Canon, TDTy->getDecl());
}
- return GetFullTypeName(Ctx, NonRefTy);
+ return GetFullTypeName(Ctx, Canon);
}
static std::string EnumToString(const Value &V) {
```
Would you be able to see if this also works for what you found with `UnaryTransformType` ?
https://github.com/llvm/llvm-project/pull/186105
More information about the cfe-commits
mailing list