diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-12-16 22:49:17 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-12-16 22:49:17 +0000 |
commit | bf22a4eaeed17e2db5a83dfd8a7bb78af7b2ea00 (patch) | |
tree | 8738f19c74d64fa63adc2c1248be02ae3c4d7fa5 /clang/lib/CodeGen/CGExprComplex.cpp | |
parent | 494a625fee4c9360f0e7ee5746831e19038a51b9 (diff) | |
download | bcm5719-llvm-bf22a4eaeed17e2db5a83dfd8a7bb78af7b2ea00.tar.gz bcm5719-llvm-bf22a4eaeed17e2db5a83dfd8a7bb78af7b2ea00.zip |
DebugInfo: Generalize debug info location handling
This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.
This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.
I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.
Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.
I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.
llvm-svn: 224385
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 2732d40093e..1580bbe6a29 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -81,8 +81,7 @@ public: /// EmitStoreOfComplex - Store the specified real/imag parts into the /// specified value pointer. - void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit, - SourceLocation DbgLoc); + void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit); /// EmitComplexToComplexCast - Emit a cast from complex value Val to DestType. ComplexPairTy EmitComplexToComplexCast(ComplexPairTy Val, QualType SrcType, @@ -335,11 +334,7 @@ ComplexPairTy ComplexExprEmitter::EmitLoadOfLValue(LValue lvalue, /// EmitStoreOfComplex - Store the specified real/imag parts into the /// specified value pointer. void ComplexExprEmitter::EmitStoreOfComplex(ComplexPairTy Val, LValue lvalue, - bool isInit, - SourceLocation DbgLoc) { - if (auto *DI = CGF.getDebugInfo()) - DI->EmitLocation(CGF.Builder, DbgLoc); - + bool isInit) { if (lvalue.getType()->isAtomicType()) return CGF.EmitAtomicStore(RValue::getComplex(Val), lvalue, isInit); @@ -869,7 +864,7 @@ EmitCompoundAssignLValue(const CompoundAssignOperator *E, // Truncate the result and store it into the LHS lvalue. if (LHSTy->isAnyComplexType()) { ComplexPairTy ResVal = EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy); - EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false, E->getLocStart()); + EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false); Val = RValue::getComplex(ResVal); } else { llvm::Value *ResVal = @@ -914,7 +909,7 @@ LValue ComplexExprEmitter::EmitBinAssignLValue(const BinaryOperator *E, LValue LHS = CGF.EmitLValue(E->getLHS()); // Store the result value into the LHS lvalue. - EmitStoreOfComplex(Val, LHS, /*isInit*/ false, E->getLocStart()); + EmitStoreOfComplex(Val, LHS, /*isInit*/ false); return LHS; } @@ -1042,19 +1037,18 @@ ComplexPairTy CodeGenFunction::EmitComplexExpr(const Expr *E, bool IgnoreReal, } void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest, - bool isInit, - SourceLocation DbgLoc) { + bool isInit) { assert(E && getComplexType(E->getType()) && "Invalid complex expression to emit"); ComplexExprEmitter Emitter(*this); ComplexPairTy Val = Emitter.Visit(const_cast<Expr*>(E)); - Emitter.EmitStoreOfComplex(Val, dest, isInit, DbgLoc); + Emitter.EmitStoreOfComplex(Val, dest, isInit); } /// EmitStoreOfComplex - Store a complex number into the specified l-value. void CodeGenFunction::EmitStoreOfComplex(ComplexPairTy V, LValue dest, - bool isInit, SourceLocation DbgLoc) { - ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit, DbgLoc); + bool isInit) { + ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit); } /// EmitLoadOfComplex - Load a complex number from the specified address. |