aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-04 23:06:26 +0000
committerChris Lattner <sabre@nondot.org>2006-10-04 23:06:26 +0000
commitdf20b96ffdbadf4e3e4addc12debac0cf855f540 (patch)
treeb8888cda5d6f703114c31853fd88e4a1f740fff7
parent693163e74d047a05799eaaf619ba4972fdc3a0e9 (diff)
getFilename/getDirectory shouldn't abort if the global has no init. This
can happen on bugpoint reduced testcases f.e.. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30729 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/IntrinsicInst.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp
index a85d9a4b22..5c43b6f5e1 100644
--- a/lib/VMCore/IntrinsicInst.cpp
+++ b/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();
}