diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-07-07 20:25:10 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-07-07 20:25:10 +0000 |
commit | d755e6ac4828d6de90afca6eb64a7f90a33f603c (patch) | |
tree | 542db1ece629529322f3f0ab67dd11aee223ead4 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 77a9e6e7df7f38b9f0509c570df6fe3f7fa0eb7c (diff) | |
download | bcm5719-llvm-d755e6ac4828d6de90afca6eb64a7f90a33f603c.tar.gz bcm5719-llvm-d755e6ac4828d6de90afca6eb64a7f90a33f603c.zip |
A redeclaration of an inline method in C99 mode should trigger emission of that
function. Fixes PR10233!
llvm-svn: 134634
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ddef39726f7..b2905299e4a 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,8 +740,21 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { } // Forward declarations are emitted lazily on first use. - if (!FD->doesThisDeclarationHaveABody()) + 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); return; + } } else { const VarDecl *VD = cast<VarDecl>(Global); assert(VD->isFileVarDecl() && "Cannot emit local var decl as global."); |