[llvm] r185249 - Debug Info: clean up usage of Verify.
David Blaikie
dblaikie at gmail.com
Sat Jun 29 18:34:12 PDT 2013
On Jun 28, 2013 10:04 PM, "Manman Ren" <mren at apple.com> wrote:
>
> Author: mren
> Date: Sat Jun 29 00:01:19 2013
> New Revision: 185249
>
> URL: http://llvm.org/viewvc/llvm-project?rev=185249&view=rev
> Log:
> 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.
>
> Modified:
> llvm/trunk/lib/IR/DIBuilder.cpp
> llvm/trunk/lib/IR/DebugInfo.cpp
>
> Modified: llvm/trunk/lib/IR/DIBuilder.cpp
> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=185249&r1=185248&r2=185249&view=diff
>
==============================================================================
> --- llvm/trunk/lib/IR/DIBuilder.cpp (original)
> +++ llvm/trunk/lib/IR/DIBuilder.cpp Sat Jun 29 00:01:19 2013
> @@ -1153,7 +1153,8 @@ DILexicalBlock DIBuilder::createLexicalB
> 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(Va
> 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::insertDbgValueIn
> 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::insertDbgValueIn
> 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);
>
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=185249&r1=185248&r2=185249&view=diff
>
==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Sat Jun 29 00:01:19 2013
> @@ -1213,8 +1213,10 @@ static void printDebugLoc(DebugLoc DL, r
> 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.");
As I mentioned in my previous email - I'm not sure if/when this happens.
Can you confirm that there are correct cases where a drebugloc has a null
scope? What are those cases? Do we have tests for them? (If there are no
such cases, letas drop the check below)
> // Omit the directory, because it's likely to be long and
uninteresting.
> - if (Scope.Verify())
> + if (Scope)
> CommentOS << Scope.getFilename();
> else
> CommentOS << "<unknown>";
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130629/62084c4e/attachment.html>
More information about the llvm-commits
mailing list