summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/IR/DIBuilder.cpp12
-rw-r--r--lib/IR/DebugInfo.cpp4
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index e30dcdca32..ab61b88ef8 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -1153,7 +1153,8 @@ DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
Instruction *InsertBefore) {
assert(Storage && "no storage passed to dbg.declare");
- assert(VarInfo.Verify() && "empty DIVariable passed to dbg.declare");
+ assert(VarInfo.isVariable() &&
+ "empty or invalid DIVariable passed to dbg.declare");
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
@@ -1165,7 +1166,8 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
BasicBlock *InsertAtEnd) {
assert(Storage && "no storage passed to dbg.declare");
- assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.declare");
+ assert(VarInfo.isVariable() &&
+ "empty or invalid DIVariable passed to dbg.declare");
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
@@ -1184,7 +1186,8 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable VarInfo,
Instruction *InsertBefore) {
assert(V && "no value passed to dbg.value");
- assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.value");
+ assert(VarInfo.isVariable() &&
+ "empty or invalid DIVariable passed to dbg.value");
if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
@@ -1199,7 +1202,8 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable VarInfo,
BasicBlock *InsertAtEnd) {
assert(V && "no value passed to dbg.value");
- assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.value");
+ assert(VarInfo.isVariable() &&
+ "empty or invalid DIVariable passed to dbg.value");
if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index 77e29e6ad1..d932adc7f3 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -1213,8 +1213,10 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
const LLVMContext &Ctx) {
if (!DL.isUnknown()) { // Print source line info.
DIScope Scope(DL.getScope(Ctx));
+ assert((!Scope || Scope.isScope()) &&
+ "Scope of a DebugLoc should be null or a DIScope.");
// Omit the directory, because it's likely to be long and uninteresting.
- if (Scope.Verify())
+ if (Scope)
CommentOS << Scope.getFilename();
else
CommentOS << "<unknown>";