extern "C" should preserve the 'extern' qualifier for VarDecls. Fixes 6853728.

llvm-svn: 71957
This commit is contained in:
Anders Carlsson
2009-05-16 21:02:39 +00:00
parent 524d5a4f5a
commit d3a69ceaaf
3 changed files with 17 additions and 3 deletions

View File

@@ -538,8 +538,9 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
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.