From df20b96ffdbadf4e3e4addc12debac0cf855f540 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 4 Oct 2006 23:06:26 +0000 Subject: [PATCH] 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 --- lib/VMCore/IntrinsicInst.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp index a85d9a4b223..5c43b6f5e1d 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(getContext()); + if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast(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(getContext()); + if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast(GV->getInitializer()); return CS->getOperand(4)->getStringValue(); }