diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-29 20:07:52 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-29 20:07:52 +0000 |
commit | ab411c8c2efed8f2403bf8596e780c0f2f905a19 (patch) | |
tree | decd291e749aa254cda769b595e6b6e409cdf167 /lib/AST/ASTContext.cpp | |
parent | 0b3620066bfbb33004bed1816c851a923b9301af (diff) |
Weak references and variables that are not definitions are not required for early codegen/deserialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109796 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index af19e89fd9..633538f312 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -5550,6 +5550,10 @@ bool ASTContext::DeclIsRequiredFunctionOrFileScopedVar(const Decl *D) { } 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 @@ bool ASTContext::DeclIsRequiredFunctionOrFileScopedVar(const Decl *D) { 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. |