[PATCH] D37428: Debug info: Fixed faulty debug locations for attributed statements

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 4 08:44:14 PDT 2017


Seems like the test case should/could be simplified a bit, maybe? (could it
be something really simple like "void f(bool b) { #pragma ... while (b) ;
}"?)

Also, is it relying on LLVM optimizations to run (add
"-disable-llvm-passes" to the command line to be sure it isn't, perhaps?)?

On Sun, Sep 3, 2017 at 10:35 AM Karl-Johan Karlsson via Phabricator via
cfe-commits <cfe-commits at lists.llvm.org> wrote:

> Ka-Ka created this revision.
> Herald added a subscriber: aprantl.
>
> As no stoppoint was generated the attributed statements got faulty debug
> locations.
>
>
> https://reviews.llvm.org/D37428
>
> Files:
>   lib/CodeGen/CGStmt.cpp
>   test/CodeGen/debug-info-attributed-stmt.c
>
>
> Index: test/CodeGen/debug-info-attributed-stmt.c
> ===================================================================
> --- /dev/null
> +++ test/CodeGen/debug-info-attributed-stmt.c
> @@ -0,0 +1,19 @@
> +// RUN: %clang_cc1 -triple x86_64-unk-unk -debug-info-kind=limited
> -emit-llvm %s -o - | FileCheck %s
> +int data[50] = { 0 };
> +
> +void foo()
> +{
> +    int i = 0;
> +    int x = 7;
> +#pragma nounroll
> +    while (i < 50)
> +    {
> +        data[i] = i;
> +        ++i;
> +    }
> +
> +// CHECK: br label %while.cond, !dbg ![[NUM:[0-9]+]]
> +// CHECK: br i1 %cmp, label %while.body, label %while.end, !dbg ![[NUM]]
> +// CHECK: br label %while.cond, !dbg ![[NUM]], !llvm.loop
> +// CHECK: ![[NUM]] = !DILocation(line: 9, scope: !14)
> +}
> Index: lib/CodeGen/CGStmt.cpp
> ===================================================================
> --- lib/CodeGen/CGStmt.cpp
> +++ lib/CodeGen/CGStmt.cpp
> @@ -556,6 +556,10 @@
>
>  void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) {
>    const Stmt *SubStmt = S.getSubStmt();
> +
> +  // Generate a stoppoint if we are emitting debug info.
> +  EmitStopPoint(SubStmt);
> +
>    switch (SubStmt->getStmtClass()) {
>    case Stmt::DoStmtClass:
>      EmitDoStmt(cast<DoStmt>(*SubStmt), S.getAttrs());
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170904/72628920/attachment.html>


More information about the cfe-commits mailing list