1 // RUN: dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/inlined-static-variable -o - | llvm-dwarfdump - | FileCheck %s --implicit-check-not "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" 2 3 // RUN: dsymutil --linker llvm -f -y %p/dummy-debug-map.map -oso-prepend-path \ 4 // RUN: %p/../Inputs/inlined-static-variable -o - | llvm-dwarfdump - | \ 5 // RUN: FileCheck %s --implicit-check-not \ 6 // RUN: "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" 7 8 // clang -g -c inlined-static-variable.cpp -o 4.o 9 10 // The functions removed and not_removed are not in the debug map and are 11 // considered dead, but they are also inlined into the function foo which is 12 // in the debug map. Those function-local globals are alive and thus should 13 // have locations in the debug info even if their functions do not. 14 15 inline __attribute__((always_inline)) int removed() { 16 static int a = 0; 17 return ++a; 18 } 19 20 __attribute__((always_inline)) int not_removed() { 21 static int b = 0; 22 return ++b; 23 } 24 25 int unused() { 26 static int c = 0; 27 return ++c; 28 } 29 30 int foo() { 31 return removed() + not_removed(); 32 } 33 34 // CHECK: DW_TAG_compile_unit 35 // CHECK: DW_AT_low_pc 36 // CHECK: DW_AT_high_pc 37 38 // CHECK: DW_TAG_subprogram 39 // CHECK: DW_AT_name ("removed") 40 // CHECK: DW_TAG_variable 41 // CHECK: DW_AT_name ("a") 42 // CHECK: DW_AT_location 43 // CHECK: NULL 44 45 // CHECK: DW_TAG_base_type 46 // CHECK: DW_TAG_subprogram 47 // CHECK: DW_AT_name ("not_removed") 48 // CHECK: DW_TAG_variable 49 // CHECK: DW_AT_name ("b") 50 // CHECK: DW_AT_location 51 // CHECK: NULL 52 53 // CHECK: DW_TAG_subprogram 54 // CHECK: DW_AT_low_pc 55 // CHECK: DW_AT_high_pc 56 // CHECK: DW_AT_name ("foo") 57 // CHECK: DW_TAG_inlined_subroutine 58 // CHECK: DW_AT_low_pc 59 // CHECK: DW_AT_high_pc 60 // CHECK: DW_TAG_inlined_subroutine 61 // CHECK: DW_AT_low_pc 62 // CHECK: DW_AT_high_pc 63 // CHECK: NULL 64 // CHECK: NULL 65