For PR950:
[oota-llvm.git] / lib / VMCore / IntrinsicInst.cpp
index 2f3ade34c13950f0e03a6468228c76db8e0e33fc..5c43b6f5e1d9a724343159e9edfe39f5f1f59f88 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/IntrinsicInst.h"
-
 #include "llvm/Constants.h"
 #include "llvm/GlobalVariable.h"
-
+#include "llvm/CodeGen/MachineDebugInfo.h"
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -59,13 +58,19 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) {
 ///
 
 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();
 }
 
 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();
 }