[llvm] r226616 - DebugLocs without a scope should fail the verification.

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Jan 20 20:18:59 PST 2015


> On 2015 Jan 20, at 14:37, Adrian Prantl <aprantl at apple.com> wrote:
> 
> Author: adrian
> Date: Tue Jan 20 16:37:25 2015
> New Revision: 226616
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=226616&view=rev
> Log:
> DebugLocs without a scope should fail the verification.
> Follow-up to r226588.
> 
> Added:
>    llvm/trunk/test/DebugInfo/location-verifier.ll
> Modified:
>    llvm/trunk/lib/IR/DebugInfo.cpp
> 
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=226616&r1=226615&r2=226616&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Tue Jan 20 16:37:25 2015
> @@ -527,15 +527,15 @@ bool DISubprogram::Verify() const {
>         while ((IA = DL.getInlinedAt()))
>           DL = DebugLoc::getFromDILocation(IA);
>         DL.getScopeAndInlinedAt(Scope, IA);
> -        assert(Scope && "debug location has no scope");
> +        if (!Scope)
> +          return false;

This one is covered by the test, but...

>         assert(!IA);
>         while (!DIDescriptor(Scope).isSubprogram()) {
>           DILexicalBlockFile D(Scope);
>           Scope = D.isLexicalBlockFile()
>                       ? D.getScope()
>                       : DebugLoc::getFromDILexicalBlock(Scope).getScope();
> -          if (!Scope)
> -            llvm_unreachable("lexical block file has no scope");
> +          assert(Scope && "lexical block file has no scope");

... this one isn't, and I think it should also be:

    if (!Scope)
      return false;


>         }
>         if (!DISubprogram(Scope).describes(F))
>           return false;
> 
> Added: llvm/trunk/test/DebugInfo/location-verifier.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/location-verifier.ll?rev=226616&view=auto
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/location-verifier.ll (added)
> +++ llvm/trunk/test/DebugInfo/location-verifier.ll Tue Jan 20 16:37:25 2015
> @@ -0,0 +1,33 @@
> +; RUN: not llvm-as -disable-output -verify-debug-info < %s 2>&1 | FileCheck %s
> +; ModuleID = 'test.c'
> +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-apple-macosx10.10.0"
> +
> +; Function Attrs: nounwind ssp uwtable
> +define i32 @foo() #0 {
> +entry:
> +  ret i32 42, !dbg !13
> +}
> +
> +attributes #0 = { nounwind ssp uwtable }
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!9, !10, !11}
> +!llvm.ident = !{!12}
> +
> +!0 = !{!"0x11\0012\00clang version 3.7.0 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/test.c] [DW_LANG_C99]
> +!1 = !{!"test.c", !""}
> +!2 = !{}
> +!3 = !{!4}
> +!4 = !{!"0x2e\00foo\00foo\00\001\000\001\000\000\000\000\001", !1, !5, !6, null, i32 ()* @foo, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [foo]
> +!5 = !{!"0x29", !1}                               ; [ DW_TAG_file_type ] [/test.c]
> +!6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
> +!7 = !{!8}
> +!8 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
> +!9 = !{i32 2, !"Dwarf Version", i32 2}
> +!10 = !{i32 2, !"Debug Info Version", i32 2}
> +!11 = !{i32 1, !"PIC Level", i32 2}
> +!12 = !{!"clang version 3.7.0 "}
> +; An old-style MDLocation should not pass verify.
> +; CHECK: DISubprogram does not Verify
> +!13 = !{i32 2, i32 2, !4, null}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list