diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-04 23:06:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-04 23:06:26 +0000 |
commit | 19721e8749bb934fbc56b10a3d42d98ca6b338cf (patch) | |
tree | 9a027d7dadf8b507c2f040fc2d5c952ddef146c9 /llvm/lib/VMCore/IntrinsicInst.cpp | |
parent | f80dfa83a0336651d6930f6e188b67b07df93c39 (diff) | |
download | bcm5719-llvm-19721e8749bb934fbc56b10a3d42d98ca6b338cf.tar.gz bcm5719-llvm-19721e8749bb934fbc56b10a3d42d98ca6b338cf.zip |
getFilename/getDirectory shouldn't abort if the global has no init. This
can happen on bugpoint reduced testcases f.e..
llvm-svn: 30729
Diffstat (limited to 'llvm/lib/VMCore/IntrinsicInst.cpp')
-rw-r--r-- | llvm/lib/VMCore/IntrinsicInst.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/IntrinsicInst.cpp b/llvm/lib/VMCore/IntrinsicInst.cpp index a85d9a4b223..5c43b6f5e1d 100644 --- a/llvm/lib/VMCore/IntrinsicInst.cpp +++ b/llvm/lib/VMCore/IntrinsicInst.cpp @@ -26,11 +26,9 @@ //===----------------------------------------------------------------------===// #include "llvm/IntrinsicInst.h" - #include "llvm/Constants.h" #include "llvm/GlobalVariable.h" #include "llvm/CodeGen/MachineDebugInfo.h" - using namespace llvm; //===----------------------------------------------------------------------===// @@ -63,6 +61,7 @@ std::string DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices"); GlobalVariable *GV = cast<GlobalVariable>(getContext()); + if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer()); return CS->getOperand(3)->getStringValue(); } @@ -71,6 +70,7 @@ std::string DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices"); GlobalVariable *GV = cast<GlobalVariable>(getContext()); + if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer()); return CS->getOperand(4)->getStringValue(); } |