[clang] [AST] Add dump() method to TypeLoc (PR #65484)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 8 06:35:31 PDT 2023
================
@@ -415,9 +443,55 @@ class ASTNodeTraverser
if (!T->isSugared())
Visit(T->getPattern());
}
+ void VisitAutoType(const AutoType *T) {
+ for (const auto &Arg : T->getTypeConstraintArguments())
+ Visit(Arg);
+ }
// FIXME: ElaboratedType, DependentNameType,
// DependentTemplateSpecializationType, ObjCObjectType
+ // For TypeLocs, we automatically visit the inner type loc (pointee type etc).
+ // We must explicitly visit other lexically-nested nodes.
+ void VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {
+ TypeLocVisitor<Derived>::VisitFunctionTypeLoc(TL);
+ for (const auto *Param : TL.getParams())
+ Visit(Param, /*VisitTypeLocs=*/true);
+ }
+ void VisitAutoTypeLoc(AutoTypeLoc TL) {
+ if (const auto *CR = TL.getConceptReference()) {
----------------
AaronBallman wrote:
And if it's not a concept reference? e.g., `void func(auto a) { decltype(auto) b = 12; }` (probably good test case to add)
https://github.com/llvm/llvm-project/pull/65484
More information about the cfe-commits
mailing list