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