Make sure C++ variable definitions are actually passed to the consumer when loaded from PCH.

llvm-svn: 110322
This commit is contained in:
Argyrios Kyrtzidis 2010-08-05 09:47:59 +00:00
parent 0cdda02f44
commit 4ba81b2ee4
3 changed files with 5 additions and 1 deletions

View File

@ -1350,7 +1350,8 @@ static bool isConsumerInterestedIn(Decl *D) {
if (isa<FileScopeAsmDecl>(D))
return true;
if (VarDecl *Var = dyn_cast<VarDecl>(D))
return Var->isFileVarDecl() && Var->getInit();
return Var->isFileVarDecl() &&
Var->isThisDeclarationADefinition() == VarDecl::Definition;
if (FunctionDecl *Func = dyn_cast<FunctionDecl>(D))
return Func->isThisDeclarationADefinition();
return isa<ObjCProtocolDecl>(D);

View File

@ -7,3 +7,4 @@
// CHECK: @_ZL5globS = internal global %struct.S zeroinitializer
// CHECK: @_ZL3bar = internal global i32 0, align 4
// CHECK: @glob_var = global i32 0

View File

@ -8,3 +8,5 @@ static S globS;
extern int ext_foo;
static int bar = ++ext_foo;
int glob_var;