Debug Info: clean up usage of Verify.

No functionality change.
It should suffice to check the type of a debug info metadata, instead of
calling Verify. For cases where we know the type of a DI metadata, use
assert.

llvm-svn: 185249
This commit is contained in:
Manman Ren 2013-06-29 05:01:19 +00:00
parent 3628b6a7c6
commit 9822a1104c
2 changed files with 11 additions and 5 deletions

View File

@ -1153,7 +1153,8 @@ DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo, Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
Instruction *InsertBefore) { Instruction *InsertBefore) {
assert(Storage && "no storage passed to dbg.declare"); 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) if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare); 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, Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
BasicBlock *InsertAtEnd) { BasicBlock *InsertAtEnd) {
assert(Storage && "no storage passed to dbg.declare"); 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) if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare); DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
@ -1184,7 +1186,8 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable VarInfo, DIVariable VarInfo,
Instruction *InsertBefore) { Instruction *InsertBefore) {
assert(V && "no value passed to dbg.value"); 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) if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value); ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
@ -1199,7 +1202,8 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable VarInfo, DIVariable VarInfo,
BasicBlock *InsertAtEnd) { BasicBlock *InsertAtEnd) {
assert(V && "no value passed to dbg.value"); 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) if (!ValueFn)
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value); ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);

View File

@ -1213,8 +1213,10 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
const LLVMContext &Ctx) { const LLVMContext &Ctx) {
if (!DL.isUnknown()) { // Print source line info. if (!DL.isUnknown()) { // Print source line info.
DIScope Scope(DL.getScope(Ctx)); 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. // Omit the directory, because it's likely to be long and uninteresting.
if (Scope.Verify()) if (Scope)
CommentOS << Scope.getFilename(); CommentOS << Scope.getFilename();
else else
CommentOS << "<unknown>"; CommentOS << "<unknown>";