[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:30 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) {
----------------
AaronBallman wrote:

Do we need to explicitly visit the return type? (It would be good to have a test case with a function declaration with a regular return type and one with a trailing return type, and probably another test with a lambda expression. Also good to have a test case involving a function template.)

What about things like exception specifications? e.g., `void func() throw(int);`

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


More information about the cfe-commits mailing list