From 617ba48fd5731d1a5ffe21aa74cb74a5c886aeb6 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 30 May 2008 11:13:18 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e5bd15e8566d..43c7129010b2 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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()); -- cgit v1.2.3