Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1992,7 +1992,8 @@ return false; } - if (D->hasAttr() || D->hasAttr()) + if (D->hasAttr() || D->hasAttr() || + D->hasAttr()) return false; if (isa(D)) Index: clang/test/Sema/warn-unused-variables.c =================================================================== --- clang/test/Sema/warn-unused-variables.c +++ clang/test/Sema/warn-unused-variables.c @@ -30,3 +30,8 @@ (void)(^() { int X = 4; }); // expected-warning{{unused}} (void)(^() { int X = 4; return Y + X; }); // expected-error {{use of undeclared identifier 'Y'}} } + +void c1(int *); +void f4(void) { + int __attribute__((cleanup(c1))) X1 = 4; +}