summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-02-03 22:37:17 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-02-03 22:37:17 +0000
commit14177b748a40c9624c7bc0c3612e33bc8c00b747 (patch)
tree43a64c610f3559231b85c4c70fe56ba7f6698d38 /clang/lib
parent71ac240620c4fedb6e49c302c490e99bb2d37eb4 (diff)
downloadbcm5719-llvm-14177b748a40c9624c7bc0c3612e33bc8c00b747.tar.gz
bcm5719-llvm-14177b748a40c9624c7bc0c3612e33bc8c00b747.zip
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. llvm-svn: 228053
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 49165d550e2..951895f5f04 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -3393,11 +3393,12 @@ Value *CodeGenFunction::EmitScalarExpr(const Expr *E, bool IgnoreResultAssign) {
assert(E && hasScalarEvaluationKind(E->getType()) &&
"Invalid scalar expression to emit");
+ bool hasDebugInfo = getDebugInfo();
if (isa<CXXDefaultArgExpr>(E))
disableDebugInfo();
Value *V = ScalarExprEmitter(*this, IgnoreResultAssign)
.Visit(const_cast<Expr*>(E));
- if (isa<CXXDefaultArgExpr>(E))
+ if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
enableDebugInfo();
return V;
}
OpenPOWER on IntegriCloud