summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-29 20:07:52 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-29 20:07:52 +0000
commit6e03a7476fdfd428cb9ed96023008cb9abd54dee (patch)
tree7aae484999fff28ed3a8690a37d81ccb3af6f744 /clang/lib/AST/ASTContext.cpp
parent5fb47cd53551e6b89fc3c5db74e7a383e655c79e (diff)
downloadbcm5719-llvm-6e03a7476fdfd428cb9ed96023008cb9abd54dee.tar.gz
bcm5719-llvm-6e03a7476fdfd428cb9ed96023008cb9abd54dee.zip
Weak references and variables that are not definitions are not required for early codegen/deserialization.
llvm-svn: 109796
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index af19e89fd9d..633538f3129 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud