[cfe-commits] r71957 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/extern-c.cpp test/CodeGenCXX/mangle.cpp
Douglas Gregor
dgregor at apple.com
Mon May 18 11:32:58 PDT 2009
On May 16, 2009, at 2:02 PM, Anders Carlsson wrote:
> Author: andersca
> Date: Sat May 16 16:02:39 2009
> New Revision: 71957
>
> URL: http://llvm.org/viewvc/llvm-project?rev=71957&view=rev
> Log:
> extern "C" should preserve the 'extern' qualifier for VarDecls.
> Fixes 6853728.
>
>
> Added:
> cfe/trunk/test/CodeGenCXX/extern-c.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/test/CodeGenCXX/mangle.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=71957&r1=71956&r2=71957&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat May 16 16:02:39 2009
> @@ -538,8 +538,9 @@
> assert(VD->isFileVarDecl() && "Cannot emit local var decl as
> global.");
>
> // In C++, if this is marked "extern", defer code generation.
> - if (getLangOptions().CPlusPlus &&
> - VD->getStorageClass() == VarDecl::Extern && !VD->getInit())
> + if (getLangOptions().CPlusPlus && !VD->getInit() &&
> + (VD->getStorageClass() == VarDecl::Extern ||
> + VD->isExternC(getContext())))
> return;
>
> // In C, if this isn't a definition, defer code generation.
Hmmm... does this work properly for
extern "C++" int var1;
?
- Doug
More information about the cfe-commits
mailing list