]> granicus.if.org Git - clang/commit
DebugInfo: Ensure calls to functions with default arguments which themselves have...
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 3 Feb 2015 22:37:17 +0000 (22:37 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 3 Feb 2015 22:37:17 +0000 (22:37 +0000)
commit1f6936185b95a45fedeff6267457b68aeeea1578
treec0aad2e99275e0d7dcbc0361ea934c8115d6c523
parent3f3358dc5aa5c4bb4378edd3ee8d2ecee1dea161
DebugInfo: Ensure calls to functions with default arguments which themselves have default arguments, still have locations.

To handle default arguments in C++ in the debug info, we disable code
updating the debug location during the emission of default arguments.

This code was buggy in the case of default arguments which, themselves,
have default arguments - the inner default argument would re-enable
debug info when it was finished, but before the outer default argument
was finished.

This was already a bug, but got worse (because a crasher instead of just
a quality bug) with the recent improvements to debug info line quality
because... The ApplyDebugLocation scoped device would find the debug
info disabled and not save any debug location. But then in
~ApplyDebugLocation it would find the debug info had been enabled and
would then apply the no-location. Then the outer function call would be
emitted without any location. That's bad.

Arguably we could /also/ fix the ApplyDebugLocation to assert on this
situation (where debug info was disabled in the ctor and enabled in the
dtor, or the other way around) but this is at least the necessary fix
regardless.

(also, I imagine this disabling behavior might need to be in-place for
CGExprComplex and CGExprAgg too, maybe... ?)

And I seem to recall seeing some weird default arg stepping behavior
recently which might be related to this too... I'll have to look into
it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228053 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprScalar.cpp
test/CodeGenCXX/debug-info-line.cpp