[cfe-commits] r120872 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/warn-unused-function.c

John McCall rjmccall at apple.com
Sun Dec 5 20:33:21 PST 2010


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.

John.



More information about the cfe-commits mailing list