[cfe-commits] r120872 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/warn-unused-function.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Dec 3 17:12:11 PST 2010
Author: akirtzidis
Date: Fri Dec 3 19:12:11 2010
New Revision: 120872
URL: http://llvm.org/viewvc/llvm-project?rev=120872&view=rev
Log:
Mark functions referenced by 'cleanup' attribute as used. Fixes rdar://8728293
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/warn-unused-function.c
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=120872&r1=120871&r2=120872&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Dec 3 19:12:11 2010
@@ -1450,6 +1450,7 @@
}
d->addAttr(::new (S.Context) CleanupAttr(Attr.getLoc(), S.Context, FD));
+ FD->setUsed();
}
/// Handle __attribute__((format_arg((idx)))) attribute based on
Modified: cfe/trunk/test/Sema/warn-unused-function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-unused-function.c?rev=120872&r1=120871&r2=120872&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-unused-function.c (original)
+++ cfe/trunk/test/Sema/warn-unused-function.c Fri Dec 3 19:12:11 2010
@@ -47,3 +47,10 @@
// PR7923
static void unused(void) { unused(); } // expected-warning{{unused}}
+
+// rdar://8728293
+static void cleanupMalloc(char * const * const allocation) { }
+void f13(void) {
+ char * const __attribute__((cleanup(cleanupMalloc))) a;
+ (void)a;
+}
More information about the cfe-commits
mailing list