diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Decl.cpp | 26 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 17 |
3 files changed, 3 insertions, 42 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index f2bd47dfa5f..e2fa4e504a2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6376,7 +6376,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { // Forward declarations aren't required. if (!FD->doesThisDeclarationHaveABody()) - return FD->doesDeclarationForceExternallyVisibleDefinition(); + return false; // Constructors and destructors are required. if (FD->hasAttr<ConstructorAttr>() || FD->hasAttr<DestructorAttr>()) diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 9feec9d82ab..9b507cfc5e2 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1762,32 +1762,6 @@ bool FunctionDecl::isInlined() const { return false; } -/// \brief For a function declaration in C or C++, determine whether this -/// declaration causes the definition to be externally visible. -/// -/// Determines whether this is the first non-inline redeclaration of an inline -/// function in a language where "inline" does not normally require an -/// externally visible definition. -bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const { - assert(!doesThisDeclarationHaveABody() && - "Must have a declaration without a body."); - - ASTContext &Context = getASTContext(); - - // In C99 mode, a function may have an inline definition (causing it to - // be deferred) then redeclared later. As a special case, "extern inline" - // is not required to produce an external symbol. - if (Context.getLangOptions().GNUInline || !Context.getLangOptions().C99 || - Context.getLangOptions().CPlusPlus) - return false; - if (getLinkage() != ExternalLinkage || isInlineSpecified()) - return false; - const FunctionDecl *InlineDefinition = 0; - if (hasBody(InlineDefinition)) - return InlineDefinition->isInlineDefinitionExternallyVisible(); - return false; -} - /// \brief For an inline function definition in C or C++, determine whether the /// definition will be externally visible. /// diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b2905299e4a..ddef39726f7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -597,7 +597,7 @@ void CodeGenModule::EmitLLVMUsed() { void CodeGenModule::EmitDeferred() { // Emit code for any potentially referenced deferred decls. Since a // previously unused static decl may become used during the generation of code - // for a static function, iterate until no changes are made. + // for a static function, iterate until no changes are made. while (!DeferredDeclsToEmit.empty() || !DeferredVTables.empty()) { if (!DeferredVTables.empty()) { @@ -740,21 +740,8 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { } // Forward declarations are emitted lazily on first use. - if (!FD->doesThisDeclarationHaveABody()) { - if (!FD->doesDeclarationForceExternallyVisibleDefinition()) - return; - - const FunctionDecl *InlineDefinition = 0; - FD->getBody(InlineDefinition); - - llvm::StringRef MangledName = getMangledName(GD); - llvm::StringMap<GlobalDecl>::iterator DDI = - DeferredDecls.find(MangledName); - if (DDI != DeferredDecls.end()) - DeferredDecls.erase(DDI); - EmitGlobalDefinition(InlineDefinition); + if (!FD->doesThisDeclarationHaveABody()) return; - } } else { const VarDecl *VD = cast<VarDecl>(Global); assert(VD->isFileVarDecl() && "Cannot emit local var decl as global."); |