mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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
This commit is contained in:
parent
693163e74d
commit
df20b96ffd
@ -26,11 +26,9 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/IntrinsicInst.h"
|
#include "llvm/IntrinsicInst.h"
|
||||||
|
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/CodeGen/MachineDebugInfo.h"
|
#include "llvm/CodeGen/MachineDebugInfo.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -63,6 +61,7 @@ std::string DbgStopPointInst::getFileName() const {
|
|||||||
// Once the operand indices are verified, update this assert
|
// Once the operand indices are verified, update this assert
|
||||||
assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices");
|
assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices");
|
||||||
GlobalVariable *GV = cast<GlobalVariable>(getContext());
|
GlobalVariable *GV = cast<GlobalVariable>(getContext());
|
||||||
|
if (!GV->hasInitializer()) return "";
|
||||||
ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
|
ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
|
||||||
return CS->getOperand(3)->getStringValue();
|
return CS->getOperand(3)->getStringValue();
|
||||||
}
|
}
|
||||||
@ -71,6 +70,7 @@ std::string DbgStopPointInst::getDirectory() const {
|
|||||||
// Once the operand indices are verified, update this assert
|
// Once the operand indices are verified, update this assert
|
||||||
assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices");
|
assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices");
|
||||||
GlobalVariable *GV = cast<GlobalVariable>(getContext());
|
GlobalVariable *GV = cast<GlobalVariable>(getContext());
|
||||||
|
if (!GV->hasInitializer()) return "";
|
||||||
ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
|
ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
|
||||||
return CS->getOperand(4)->getStringValue();
|
return CS->getOperand(4)->getStringValue();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user