[clang] 40cef5a - [clang] Add a test for CGDebugInfo treatment of blocks

Scott Linder via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 9 12:09:20 PDT 2020


Author: Scott Linder
Date: 2020-10-09T19:03:21Z
New Revision: 40cef5a00eb83f44e946912b74be83e8dc02effb

URL: https://github.com/llvm/llvm-project/commit/40cef5a00eb83f44e946912b74be83e8dc02effb
DIFF: https://github.com/llvm/llvm-project/commit/40cef5a00eb83f44e946912b74be83e8dc02effb.diff

LOG: [clang] Add a test for CGDebugInfo treatment of blocks

There doesn't seem to be a direct test of this, and I'm planning to make
future changes which will affect it.

I'm not particularly familiar with the blocks extension, so suggestions
for better tests are welcome.

Differential Revision: https://reviews.llvm.org/D88754

Added: 
    clang/test/CodeGen/debug-info-block-expr.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/debug-info-block-expr.c b/clang/test/CodeGen/debug-info-block-expr.c
new file mode 100644
index 000000000000..009e7800b6ee
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-block-expr.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
+// Verify that the desired DIExpression are generated for blocks.
+
+void test() {
+// CHECK: call void @llvm.dbg.declare({{.*}}!DIExpression(DW_OP_plus_uconst, {{[0-9]+}}, DW_OP_deref, DW_OP_plus_uconst, {{[0-9]+}}){{.*}})
+  __block int i;
+// CHECK: call void @llvm.dbg.declare({{.*}}!DIExpression(DW_OP_deref, DW_OP_plus_uconst, {{[0-9]+}}, DW_OP_deref, DW_OP_plus_uconst, {{[0-9]+}}, DW_OP_deref, DW_OP_plus_uconst, {{[0-9]+}}){{.*}})
+  ^ { i = 1; }();
+}


        


More information about the cfe-commits mailing list