[clang] modified AST for SEI redemption project (PR #111705)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 05:39:09 PDT 2024


================
@@ -177,14 +193,34 @@ class ASTNodeTraverser
     if (!SQT.Quals.hasQualifiers())
       return Visit(SQT.Ty);
 
-    getNodeDelegate().AddChild([=] {
+    // SEI: changed from default label to "qualTypeDetail"
+    getNodeDelegate().AddChild("qualTypeDetail", [this, T] {
       getNodeDelegate().Visit(T);
       Visit(T.split().Ty);
     });
+
+    // SEI function pointer support. this gets called whenever the three
+    // conditions are met:
+    // 1. the function pointer is not typedef'd
+    // 2. after Visit(VarDecl *) gets called
+    // 3. if VarDecl determines this is a function pointer
+    if (T->isFunctionPointerType()) {
+      // create as a child node to this type
+      getNodeDelegate().AddChild(
+          [=] { getNodeDelegate().Visit(T->getPointeeType()); });
+    }
+
+    // SEI: traverse PointerType information
+    if (T->isPointerType())
+      Visit(T->getPointeeType());
   }
 
+  // SEI: traverse ReturnType information
+  void VisitReturnType(QualType T) { getNodeDelegate().VisitReturnType(T); }
+
   void Visit(const Type *T) {
-    getNodeDelegate().AddChild([=] {
+    // SEI: renamed this from default label
----------------
AaronBallman wrote:

```suggestion
```

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


More information about the cfe-commits mailing list