gramanas created this revision. gramanas added a reviewer: vsk. Herald added subscribers: JDevlieghere, aprantl.
In this test there is a store instruction generated by clang for the function argument `int b` where the debug info is missing. The goal of this patch is to instruct clang to add an artificial location to auto generated store instructions using ApplyDebugLocation::CreateArtificial() so that we can preserve the scope information of the dbg metadata. Repository: rC Clang https://reviews.llvm.org/D47097 Files: test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c =================================================================== --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] +
Index: test/CodeGen/debug-info-preserve-scope.c =================================================================== --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] +
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits