mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 03:26:06 +08:00
Weak references and variables that are not definitions are not required for early codegen/deserialization.
llvm-svn: 109796
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -109,3 +109,10 @@ template<typename T> struct S_PR7660 { void g(void (*)(T)); };
|
||||
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>;
|
||||
|
||||
Reference in New Issue
Block a user