[llvm-commits] [llvm-gcc-4.2] r47721 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Chris Lattner
sabre at nondot.org
Thu Feb 28 09:57:22 PST 2008
Author: lattner
Date: Thu Feb 28 11:57:22 2008
New Revision: 47721
URL: http://llvm.org/viewvc/llvm-project?rev=47721&view=rev
Log:
Fix a crash when the valuename is null, which happens when
there is no name. This fixes PR1480
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=47721&r1=47720&r2=47721&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Feb 28 11:57:22 2008
@@ -1308,8 +1308,10 @@
/// llvm_get_decl_name - Used by varasm.c, returns the specified declaration's
/// name.
const char *llvm_get_decl_name(void *LLVM) {
- if (LLVM == 0) return "";
- return ((Value*)LLVM)->getValueName()->getKeyData();
+ if (LLVM)
+ if (const ValueName *VN = ((Value*)LLVM)->getValueName())
+ return VN->getKeyData();
+ return "";
}
// llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be
More information about the llvm-commits
mailing list