]> granicus.if.org Git - clang/commitdiff
Make sure C++ variable definitions are actually passed to the consumer when loaded...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 5 Aug 2010 09:47:59 +0000 (09:47 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 5 Aug 2010 09:47:59 +0000 (09:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110322 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReaderDecl.cpp
test/PCH/cxx-required-decls.cpp
test/PCH/cxx-required-decls.h

index 7557950e66d94a1e1ad8b8c63dea3000f87afd15..a6a68d9425030626ab6e131bcdf122113b355e9a 100644 (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);
index 818958ea1e9fc8af0efe1a8f60b131b3f58d0244..8c4b11cd8414b7b3e3258e6069b89a4307c8556a 100644 (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
index df28ad6c2f8de108129d8c6b4c28fb3c5b7d8ef1..099d2da56c69ceedef20020ce2f5f69756ced17d 100644 (file)
@@ -8,3 +8,5 @@ static S globS;
 
 extern int ext_foo;
 static int bar = ++ext_foo;
+
+int glob_var;