xref: /llvm-project/clang/test/CodeGen/assignment-tracking/nested-scope.cpp (revision 4b6b2b1a425a2eabb3a4b995bb05f4f53e313afa)
1 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
2 // RUN:     -emit-llvm  -fexperimental-assignment-tracking %s -o -               \
3 // RUN: | FileCheck %s
4 
5 // Check that dbg.assign intrinsics get a !dbg with with the same scope as
6 // their variable.
7 
8 // CHECK: call void @llvm.dbg.assign({{.+}}, metadata [[local:![0-9]+]], {{.+}}, {{.+}}, {{.+}}), !dbg [[dbg:![0-9]+]]
9 // CHECK-DAG: [[local]] = !DILocalVariable(name: "local", scope: [[scope:![0-9]+]],
10 // CHECK-DAG: [[dbg]] = !DILocation({{.+}}, scope: [[scope]])
11 // CHECK-DAG: [[scope]] = distinct !DILexicalBlock
12 
13 void ext(int*);
14 void fun() {
15   {
16     int local;
17   }
18 }
19 
20