File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,11 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
321
321
return true ;
322
322
}
323
323
324
+ bool VisitCleanupAttr (CleanupAttr *attr) {
325
+ report (attr->getLocation (), attr->getFunctionDecl ());
326
+ return true ;
327
+ }
328
+
324
329
// TypeLoc visitors.
325
330
void reportType (SourceLocation RefLoc, NamedDecl *ND) {
326
331
// Reporting explicit references to types nested inside classes can cause
Original file line number Diff line number Diff line change @@ -570,5 +570,11 @@ TEST(WalkAST, OperatorNewDelete) {
570
570
testWalk (" struct A { static void $ambiguous^operator delete(void*); };" ,
571
571
" void foo() { A a; ^delete &a; }" );
572
572
}
573
+
574
+ TEST (WalkAST, CleanupAttr) {
575
+ testWalk (" void* $explicit^freep(void *p);" ,
576
+ " void foo() { __attribute__((^__cleanup__(freep))) char* x = 0; }" );
577
+ }
578
+
573
579
} // namespace
574
580
} // namespace clang::include_cleaner
You can’t perform that action at this time.
0 commit comments