Always check that the definition of a function has the correct type.

This fixes a crash on the included testcase (found in NetHack).

llvm-svn: 51767
This commit is contained in:
Eli Friedman
2008-05-30 11:13:18 +00:00
parent bf8d6cefde
commit 617ba48fd5
2 changed files with 7 additions and 1 deletions

View File

@@ -187,7 +187,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunctionDecl(const FunctionDecl *D,
bool isDefinition) {
// See if it is already in the map. If so, just return it.
llvm::Constant *&Entry = GlobalDeclMap[D];
if (Entry) return Entry;
if (!isDefinition && Entry) return Entry;
const llvm::Type *Ty = getTypes().ConvertType(D->getType());