1/* Compile with: 2 for FILE in `seq 2`; do 3 clang -g -c odr-anon-namespace.cpp -DFILE$FILE -o odr-anon-namespace/$FILE.o 4 done 5 */ 6 7// RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/odr-anon-namespace -y %p/dummy-debug-map.map -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s 8 9#ifdef FILE1 10// Currently llvm-dsymutil will unique the contents of anonymous 11// namespaces if they are from the same file/line. Force this 12// namespace to appear different eventhough it's the same (this 13// uniquing is actually a bug kept for backward compatibility, see the 14// comments in DeclContextTree::getChildDeclContext()). 15#line 42 16#endif 17namespace { 18class C {}; 19} 20 21void foo() { 22 C c; 23} 24 25// Keep the ifdef guards for FILE1 and FILE2 even if all the code is 26// above to clearly show what the CHECK lines are testing. 27#ifdef FILE1 28 29// CHECK: TAG_compile_unit 30// CHECK-NOT: DW_TAG 31// CHECK: AT_name{{.*}}"odr-anon-namespace.cpp" 32 33// CHECK: DW_TAG_variable 34// CHECK-NOT: DW_TAG 35// CHECK: DW_AT_name {{.*}}"c" 36// CHECK-NOT: DW_TAG 37// CHECK: DW_AT_type {{.*}}0x00000000[[C_FILE1:[0-9a-f]*]] 38 39// CHECK: DW_TAG_namespace 40// CHECK-NOT: {{DW_AT_name|NULL|DW_TAG}} 41// CHECK: 0x[[C_FILE1]]:{{.*}}DW_TAG_class_type 42// CHECK-NOT: DW_TAG 43// CHECK: DW_AT_name{{.*}}"C" 44 45#elif defined(FILE2) 46 47// CHECK: TAG_compile_unit 48// CHECK-NOT: DW_TAG 49// CHECK: AT_name{{.*}}"odr-anon-namespace.cpp" 50 51// CHECK: DW_TAG_variable 52// CHECK-NOT: DW_TAG 53// CHECK: DW_AT_name {{.*}}"c" 54// CHECK-NOT: DW_TAG 55// CHECK: DW_AT_type {{.*}}0x00000000[[C_FILE2:[0-9a-f]*]] 56 57// CHECK: DW_TAG_namespace 58// CHECK-NOT: {{DW_AT_name|NULL|DW_TAG}} 59// CHECK: 0x[[C_FILE2]]:{{.*}}DW_TAG_class_type 60// CHECK-NOT: DW_TAG 61// CHECK: DW_AT_name{{.*}}"C" 62 63#else 64#error "You must define which file you generate" 65#endif 66