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> {
321321 return true ;
322322 }
323323
324+ bool VisitCleanupAttr (CleanupAttr *attr) {
325+ report (attr->getLocation (), attr->getFunctionDecl ());
326+ return true ;
327+ }
328+
324329 // TypeLoc visitors.
325330 void reportType (SourceLocation RefLoc, NamedDecl *ND) {
326331 // 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) {
570570 testWalk (" struct A { static void $ambiguous^operator delete(void*); };" ,
571571 " void foo() { A a; ^delete &a; }" );
572572}
573+
574+ TEST (WalkAST, CleanupAttr) {
575+ testWalk (" void* $explicit^freep(void *p);" ,
576+ " void foo() { __attribute__((^__cleanup__(freep))) char* x = 0; }" );
577+ }
578+
573579} // namespace
574580} // namespace clang::include_cleaner
You can’t perform that action at this time.
0 commit comments