[cfe-commits] r109796 - in /cfe/trunk: lib/AST/ASTContext.cpp test/PCH/cxx-templates.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Jul 29 13:07:53 PDT 2010


Author: akirtzidis
Date: Thu Jul 29 15:07:52 2010
New Revision: 109796

URL: http://llvm.org/viewvc/llvm-project?rev=109796&view=rev
Log:
Weak references and variables that are not definitions are not required for early codegen/deserialization.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/PCH/cxx-templates.h

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=109796&r1=109795&r2=109796&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jul 29 15:07:52 2010
@@ -5550,6 +5550,10 @@
   } else if (!isa<FunctionDecl>(D))
     return false;
 
+  // Weak references don't produce any output by themselves.
+  if (D->hasAttr<WeakRefAttr>())
+    return false;
+
   // Aliases and used decls are required.
   if (D->hasAttr<AliasAttr>() || D->hasAttr<UsedAttr>())
     return true;
@@ -5587,6 +5591,9 @@
   const VarDecl *VD = cast<VarDecl>(D);
   assert(VD->isFileVarDecl() && "Expected file scoped var");
 
+  if (VD->isThisDeclarationADefinition() == VarDecl::DeclarationOnly)
+    return false;
+
   // Structs that have non-trivial constructors or destructors are required.
 
   // FIXME: Handle references.

Modified: cfe/trunk/test/PCH/cxx-templates.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-templates.h?rev=109796&r1=109795&r2=109796&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx-templates.h (original)
+++ cfe/trunk/test/PCH/cxx-templates.h Thu Jul 29 15:07:52 2010
@@ -109,3 +109,10 @@
 template<typename> class C_PR7670;
 template<> class C_PR7670<int>;
 template<> class C_PR7670<int>;
+
+template <bool B>
+struct S2 {
+    static bool V;
+};
+
+extern template class S2<true>;





More information about the cfe-commits mailing list