2013-05-20 12:58:53 +08:00
|
|
|
// RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s
|
|
|
|
// RUN: %clang -g -gline-tables-only -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
|
|
|
|
// RUN: %clang -g -fno-limit-debug-info -S -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
|
2010-10-28 07:23:58 +08:00
|
|
|
|
|
|
|
namespace A {
|
2013-03-21 03:10:57 +08:00
|
|
|
#line 1 "foo.cpp"
|
|
|
|
namespace B {
|
2013-03-20 13:12:06 +08:00
|
|
|
int i;
|
2013-05-20 12:58:53 +08:00
|
|
|
void f1() { }
|
|
|
|
void f1(int) { }
|
|
|
|
struct foo;
|
|
|
|
struct bar { };
|
|
|
|
typedef bar baz;
|
2010-10-28 07:23:58 +08:00
|
|
|
}
|
2013-04-26 13:41:06 +08:00
|
|
|
using namespace B;
|
2013-03-21 03:10:57 +08:00
|
|
|
}
|
2010-10-28 07:23:58 +08:00
|
|
|
|
2013-04-26 13:41:06 +08:00
|
|
|
using namespace A;
|
2013-05-21 06:50:41 +08:00
|
|
|
namespace E = A;
|
2013-04-26 13:41:06 +08:00
|
|
|
|
2013-05-07 07:33:13 +08:00
|
|
|
int func(bool b) {
|
|
|
|
if (b) {
|
|
|
|
using namespace A::B;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
using namespace A;
|
2013-05-20 12:58:53 +08:00
|
|
|
using B::foo;
|
|
|
|
using B::bar;
|
|
|
|
using B::f1;
|
|
|
|
using B::i;
|
|
|
|
using B::baz;
|
2013-05-21 06:50:41 +08:00
|
|
|
namespace X = A;
|
|
|
|
namespace Y = X;
|
|
|
|
return i + X::B::i + Y::B::i;
|
2013-04-22 14:13:21 +08:00
|
|
|
}
|
|
|
|
|
2013-05-20 12:58:53 +08:00
|
|
|
// This should work even if 'i' and 'func' were declarations & not definitions,
|
|
|
|
// but it doesn't yet.
|
|
|
|
|
2013-04-26 13:41:06 +08:00
|
|
|
// CHECK: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !""} ; [ DW_TAG_compile_unit ]
|
2013-03-21 07:57:15 +08:00
|
|
|
// CHECK: [[FILE:![0-9]*]] {{.*}}debug-info-namespace.cpp"
|
2013-05-20 12:58:53 +08:00
|
|
|
// CHECK: [[FOOCPP:![0-9]*]] = metadata !{metadata !"foo.cpp", {{.*}}
|
|
|
|
// CHECK: [[NS:![0-9]*]] = {{.*}}, metadata [[FILE2:![0-9]*]], metadata [[CTXT:![0-9]*]], {{.*}} ; [ DW_TAG_namespace ] [B] [line 1]
|
|
|
|
// CHECK: [[CTXT]] = {{.*}}, metadata [[FILE]], null, {{.*}} ; [ DW_TAG_namespace ] [A] [line 5]
|
|
|
|
// CHECK: [[F1:![0-9]*]] {{.*}} ; [ DW_TAG_subprogram ] [line 4] [def] [f1]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[FUNC:![0-9]*]] {{.*}} ; [ DW_TAG_subprogram ] [line 15] [def] [func]
|
2013-05-20 12:58:53 +08:00
|
|
|
// CHECK: [[FILE2]]} ; [ DW_TAG_file_type ] [{{.*}}foo.cpp]
|
|
|
|
// CHECK: [[I:![0-9]*]] = {{.*}}, metadata [[NS]], metadata !"i", {{.*}} ; [ DW_TAG_variable ] [i]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[MODULES]] = metadata !{metadata [[M1:![0-9]*]], metadata [[M2:![0-9]*]], metadata [[M3:![0-9]*]], metadata [[M4:![0-9]*]], metadata [[M5:![0-9]*]], metadata [[M6:![0-9]*]], metadata [[M7:![0-9]*]], metadata [[M8:![0-9]*]], metadata [[M9:![0-9]*]], metadata [[M10:![0-9]*]], metadata [[M11:![0-9]*]], metadata [[M12:![0-9]*]]}
|
2013-05-20 12:58:53 +08:00
|
|
|
// CHECK: [[M1]] = metadata !{i32 {{[0-9]*}}, metadata [[CTXT]], metadata [[NS]], i32 9} ; [ DW_TAG_imported_module ]
|
|
|
|
// CHECK: [[M2]] = metadata !{i32 {{[0-9]*}}, metadata [[CU]], metadata [[CTXT]], i32 12} ; [ DW_TAG_imported_module ]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[M3]] = metadata !{i32 {{[0-9]*}}, metadata [[CU]], metadata [[CTXT]], i32 13, metadata !"E"} ; [ DW_TAG_imported_module ]
|
2013-06-08 08:16:55 +08:00
|
|
|
// CHECK: [[M4]] = metadata !{i32 {{[0-9]*}}, metadata [[LEX2:![0-9]*]], metadata [[NS]], i32 17} ; [ DW_TAG_imported_module ]
|
|
|
|
// CHECK: [[LEX2]] = metadata !{i32 {{[0-9]*}}, metadata [[FILE2]], metadata [[LEX1:![0-9]+]], i32 16, i32 0, i32 {{.*}}} ; [ DW_TAG_lexical_block ]
|
|
|
|
// CHECK: [[LEX1]] = metadata !{i32 {{[0-9]*}}, metadata [[FILE2]], metadata [[FUNC]], i32 16, i32 0, i32 {{.*}}} ; [ DW_TAG_lexical_block ]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[M5]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[CTXT]], i32 20} ; [ DW_TAG_imported_module ]
|
|
|
|
// CHECK: [[M6]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[FOO:![0-9]*]], i32 21} ; [ DW_TAG_imported_declaration ]
|
2013-06-21 11:41:46 +08:00
|
|
|
// CHECK: [[FOO]] {{.*}} ; [ DW_TAG_structure_type ] [foo] [line 5, size 0, align 0, offset 0] [decl] [from ]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[M7]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAR:![0-9]*]], i32 22} ; [ DW_TAG_imported_declaration ]
|
2013-06-21 11:41:46 +08:00
|
|
|
// CHECK: [[BAR]] {{.*}} ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [decl] [from ]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[M8]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[F1]], i32 23} ; [ DW_TAG_imported_declaration ]
|
|
|
|
// CHECK: [[M9]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[I]], i32 24} ; [ DW_TAG_imported_declaration ]
|
|
|
|
// CHECK: [[M10]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAZ:![0-9]*]], i32 25} ; [ DW_TAG_imported_declaration ]
|
2013-05-20 12:58:53 +08:00
|
|
|
// CHECK: [[BAZ]] = metadata !{i32 {{[0-9]*}}, metadata [[FOOCPP]], metadata [[NS]], {{.*}} ; [ DW_TAG_typedef ] [baz] {{.*}} [from bar]
|
2013-05-21 06:50:41 +08:00
|
|
|
// CHECK: [[M11]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[CTXT]], i32 26, metadata !"X"} ; [ DW_TAG_imported_module ]
|
|
|
|
// CHECK: [[M12]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[M11]], i32 27, metadata !"Y"} ; [ DW_TAG_imported_module ]
|
2013-05-20 12:58:53 +08:00
|
|
|
|
|
|
|
// CHECK-GMLT: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !""} ; [ DW_TAG_compile_unit ]
|
|
|
|
// CHECK-GMLT: [[MODULES]] = metadata !{i32 0}
|
|
|
|
|
2013-06-21 11:41:46 +08:00
|
|
|
// CHECK-NOLIMIT: ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [def] [from ]
|
2013-03-27 02:57:40 +08:00
|
|
|
|
|
|
|
// FIXME: It is confused on win32 to generate file entry when dosish filename is given.
|
|
|
|
// REQUIRES: shell
|