On Dec 5, 2010, at 8:33 PM, John McCall wrote: > > On Dec 3, 2010, at 5:12 PM, Argyrios Kyrtzidis wrote: > >> 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(); >> } > > Technically, you can use __attribute__((cleanup)) inside a template. This > should use MarkDeclarationReferenced, and then there should be special > instantiation logic for the attribute.
Hmm, is this really the right approach ? If it's referenced from a template which is not instantiated, it's not used from the codegen perspective but how about from the user's perspective: -We emit a warning that the function 'foo' is unused. -User removes function 'foo' -Now we emit an error that 'foo' is not found. Thoughts? -Argiris > > John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
