include-cleaner: Report function decls from __cleanup__ as used (#138669)
This commit is contained in:
@@ -321,6 +321,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VisitCleanupAttr(CleanupAttr *attr) {
|
||||
report(attr->getLocation(), attr->getFunctionDecl());
|
||||
return true;
|
||||
}
|
||||
|
||||
// TypeLoc visitors.
|
||||
void reportType(SourceLocation RefLoc, NamedDecl *ND) {
|
||||
// Reporting explicit references to types nested inside classes can cause
|
||||
|
||||
@@ -570,5 +570,11 @@ TEST(WalkAST, OperatorNewDelete) {
|
||||
testWalk("struct A { static void $ambiguous^operator delete(void*); };",
|
||||
"void foo() { A a; ^delete &a; }");
|
||||
}
|
||||
|
||||
TEST(WalkAST, CleanupAttr) {
|
||||
testWalk("void* $explicit^freep(void *p);",
|
||||
"void foo() { __attribute__((^__cleanup__(freep))) char* x = 0; }");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace clang::include_cleaner
|
||||
|
||||
Reference in New Issue
Block a user