71 lines · cpp
1// RUN: dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path \2// RUN: %p/../Inputs/inlined-static-variable -o - -keep-function-for-static \3// RUN: | llvm-dwarfdump - | FileCheck %s --implicit-check-not \4// RUN: "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" \5// RUN: --check-prefixes=CHECK6//7// RUN: dsymutil --linker parallel --no-odr -f -y %p/dummy-debug-map.map \8// RUN: -oso-prepend-path %p/../Inputs/inlined-static-variable -o - \9// RUN: -keep-function-for-static | llvm-dwarfdump - | FileCheck %s \10// RUN: --implicit-check-not \11// RUN: "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" \12// RUN: --check-prefixes=CHECK13 14// clang -g -c inlined-static-variable.cpp -o 4.o15 16// The functions removed and not_removed are not in the debug map and are17// considered dead, but they are also inlined into the function foo which is18// in the debug map. Those function-local globals are alive and thus should19// have locations in the debug info even if their functions do not.20 21inline __attribute__((always_inline)) int removed() {22 static int a = 0;23 return ++a;24}25 26__attribute__((always_inline)) int not_removed() {27 static int b = 0;28 return ++b;29}30 31int unused() {32 static int c = 0;33 return ++c;34}35 36int foo() {37 return removed() + not_removed();38}39 40// CHECK: DW_TAG_compile_unit41// CHECK: DW_AT_low_pc42// CHECK: DW_AT_high_pc43 44// CHECK: DW_TAG_subprogram45// CHECK: DW_AT_name ("removed")46// CHECK: DW_TAG_variable47// CHECK: DW_AT_name ("a")48// CHECK: DW_AT_location49// CHECK: NULL50 51// CHECK: DW_TAG_base_type52// CHECK: DW_TAG_subprogram53// CHECK: DW_AT_name ("not_removed")54// CHECK: DW_TAG_variable55// CHECK: DW_AT_name ("b")56// CHECK: DW_AT_location57// CHECK: NULL58 59// CHECK: DW_TAG_subprogram60// CHECK: DW_AT_low_pc61// CHECK: DW_AT_high_pc62// CHECK: DW_AT_name ("foo")63// CHECK: DW_TAG_inlined_subroutine64// CHECK: DW_AT_low_pc65// CHECK: DW_AT_high_pc66// CHECK: DW_TAG_inlined_subroutine67// CHECK: DW_AT_low_pc68// CHECK: DW_AT_high_pc69// CHECK: NULL70// CHECK: NULL71