When IRgen refers to a function declaration that is not a definition,

and we later find the definition, make sure that we add the definition
(not the declaration) to the list of deferred definitions to
emit. Fixes PR8864.

Thanks to Nick Lewycky for testing this	patch out

llvm-svn: 125157
This commit is contained in:
Douglas Gregor
2011-02-09 02:03:05 +00:00
parent c8ae55050d
commit 2575631c0f
3 changed files with 26 additions and 2 deletions

View File

@@ -857,10 +857,10 @@ CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName,
if (isa<CXXRecordDecl>(FD->getLexicalDeclContext())) {
if (FD->isImplicit() && !ForVTable) {
assert(FD->isUsed() && "Sema didn't mark implicit function as used!");
DeferredDeclsToEmit.push_back(D);
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
} else if (FD->isThisDeclarationADefinition()) {
DeferredDeclsToEmit.push_back(D);
DeferredDeclsToEmit.push_back(D.getWithDecl(FD));
break;
}
}