2015-10-08 12:24:12 +08:00
|
|
|
// RUN: %clang_cc1 -triple %itanium_abi_triple -debug-info-kind=limited -mllvm -no-discriminators -emit-llvm %s -o - | FileCheck %s
|
PR20038: DebugInfo: Call sites without DebugLocs for temporary dtors after a conditional
With && at the top level of an expression, the last thing done when
emitting the expression was an unconditional jump to the cleanup block.
To reduce the amount of stepping, the DebugLoc is omitted from the
unconditional jump. This is done by clearing the IRBuilder's
"CurrentDebugLocation"*. If this is not set to some non-empty value
before the cleanup block is emitted, the cleanups don't get a location
either. If a call without a location is emitted in a function with debug
info, and that call is then inlined - bad things happen. (without a
location for the call site, the inliner would just leave the inlined
DebugLocs as they were - pointing to roots in the original function, not
inlined into the current function)
Follow up commit to LLVM will ensure that breaking the invariants of the
DebugLoc chains by having chains that don't lead to the current function
will fail assertions, so we shouldn't accidentally slip any of these
cases in anymore. Those assertions may reveal further cases that need to
be fixed in clang, though I've tried to test heavily to avoid that.
* See r128471, r128513 for the code that clears the
CurrentDebugLocation. Simply removing this code or moving the code
into IRBuilder to apply to all unconditional branches would regress
desired behavior, unfortunately.
llvm-svn: 211722
2014-06-26 01:57:34 +08:00
|
|
|
|
|
|
|
struct C {
|
|
|
|
~C();
|
|
|
|
};
|
|
|
|
extern bool b;
|
2014-07-11 04:42:59 +08:00
|
|
|
// CHECK: call {{.*}}, !dbg [[DTOR_CALL1_LOC:![0-9]*]]
|
|
|
|
// CHECK: call {{.*}}, !dbg [[DTOR_CALL2_LOC:![0-9]*]]
|
2015-08-27 06:50:48 +08:00
|
|
|
// CHECK: [[FUN1:.*]] = distinct !DISubprogram(name: "fun1",{{.*}} isDefinition: true
|
|
|
|
// CHECK: [[FUN2:.*]] = distinct !DISubprogram(name: "fun2",{{.*}} isDefinition: true
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[DTOR_CALL1_LOC]] = !DILocation(line: [[@LINE+1]], scope: [[FUN1]])
|
2014-07-11 04:42:59 +08:00
|
|
|
void fun1() { b && (C(), 1); }
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[DTOR_CALL2_LOC]] = !DILocation(line: [[@LINE+1]], scope: [[FUN2]])
|
2014-07-11 04:42:59 +08:00
|
|
|
bool fun2() { return (C(), b) && 0; }
|