[cfe-commits] r107303 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenObjCXX/method-local-extern-mangle.mm

Douglas Gregor dgregor at apple.com
Wed Jun 30 11:46:54 PDT 2010


On Jun 30, 2010, at 11:27 AM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Wed Jun 30 13:27:47 2010
> New Revision: 107303
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=107303&view=rev
> Log:
> extern variable declared locally to objective-c++ method
> should not be mangled either. Fixes radar 8016412.
> 
> 
> Added:
>    cfe/trunk/test/CodeGenObjCXX/method-local-extern-mangle.mm
> Modified:
>    cfe/trunk/lib/CodeGen/Mangle.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=107303&r1=107302&r2=107303&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
> +++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Jun 30 13:27:47 2010
> @@ -294,7 +294,7 @@
>   if (!FD) {
>     const DeclContext *DC = D->getDeclContext();
>     // Check for extern variable declared locally.
> -    if (isa<FunctionDecl>(DC) && D->hasLinkage())
> +    if ((isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC) ) && D->hasLinkage())
>       while (!DC->isNamespace() && !DC->isTranslationUnit())
>         DC = DC->getParent();
>     if (DC->isTranslationUnit() && D->getLinkage() != InternalLinkage)

You should use DC->isFunctionOrMethod() here, which would also handle extern variables declared locally within a block.

	- Doug





More information about the cfe-commits mailing list