summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprComplex.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-12-09 20:52:24 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-12-09 20:52:24 +0000
commit538deffd2d38bcc8a50deaca2d8efdd4eaf00440 (patch)
tree71d9467f4d1cf7433e48f52d895fc083f7158a53 /clang/lib/CodeGen/CGExprComplex.cpp
parente242e8b06431da9232f444373c9601843b5a57db (diff)
downloadbcm5719-llvm-538deffd2d38bcc8a50deaca2d8efdd4eaf00440.tar.gz
bcm5719-llvm-538deffd2d38bcc8a50deaca2d8efdd4eaf00440.zip
DebugInfo: Emit the correct location for initialization of a complex variable
Especially useful for sanitizer reports. llvm-svn: 223825
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprComplex.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index 6b7826eef5d..f3493bfbbe3 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -81,7 +81,8 @@ public:
/// EmitStoreOfComplex - Store the specified real/imag parts into the
/// specified value pointer.
- void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit);
+ void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit,
+ SourceLocation DbgLoc = SourceLocation());
/// EmitComplexToComplexCast - Emit a cast from complex value Val to DestType.
ComplexPairTy EmitComplexToComplexCast(ComplexPairTy Val, QualType SrcType,
@@ -333,9 +334,12 @@ 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) {
+void ComplexExprEmitter::EmitStoreOfComplex(ComplexPairTy Val, LValue lvalue,
+ bool isInit,
+ SourceLocation DbgLoc) {
+ if (auto *DI = CGF.getDebugInfo())
+ DI->EmitLocation(CGF.Builder, DbgLoc);
+
if (lvalue.getType()->isAtomicType())
return CGF.EmitAtomicStore(RValue::getComplex(Val), lvalue, isInit);
@@ -910,6 +914,7 @@ LValue ComplexExprEmitter::EmitBinAssignLValue(const BinaryOperator *E,
LValue LHS = CGF.EmitLValue(E->getLHS());
// Store the result value into the LHS lvalue.
+ // FIXME
EmitStoreOfComplex(Val, LHS, /*isInit*/ false);
return LHS;
@@ -1038,18 +1043,19 @@ ComplexPairTy CodeGenFunction::EmitComplexExpr(const Expr *E, bool IgnoreReal,
}
void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest,
- bool isInit) {
+ bool isInit,
+ SourceLocation DbgLoc) {
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);
+ Emitter.EmitStoreOfComplex(Val, dest, isInit, DbgLoc);
}
/// EmitStoreOfComplex - Store a complex number into the specified l-value.
void CodeGenFunction::EmitStoreOfComplex(ComplexPairTy V, LValue dest,
- bool isInit) {
- ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit);
+ bool isInit, SourceLocation DbgLoc) {
+ ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit, DbgLoc);
}
/// EmitLoadOfComplex - Load a complex number from the specified address.
OpenPOWER on IntegriCloud