/// 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,
/// 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);
LValue LHS = CGF.EmitLValue(E->getLHS());
// Store the result value into the LHS lvalue.
+ // FIXME
EmitStoreOfComplex(Val, LHS, /*isInit*/ false);
return LHS;
}
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.
/// EmitComplexExprIntoLValue - Emit the given expression of complex
/// type and place its result into the specified l-value.
- void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit);
+ void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit,
+ SourceLocation DbgLoc = SourceLocation());
/// EmitStoreOfComplex - Store a complex number into the specified l-value.
- void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit);
+ void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit,
+ SourceLocation DbgLoc = SourceLocation());
/// EmitLoadOfComplex - Load a complex number from the specified l-value.
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc);
// RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s
-int &src(); int* sink();
+int &src();
+int* sink();
+__complex float complex_src();
void f1() {
#line 100
struct foo {
int i;
int &j;
+ __complex float k;
foo();
};
#line 200
i
(src()),
- j
- (src())
// CHECK: store i32 {{.*}} !dbg [[DBG_FOO_VALUE:!.*]]
+ j
+ (src()),
// CHECK: store i32* {{.*}} !dbg [[DBG_FOO_REF:!.*]]
+ k
+ (complex_src())
+ // CHECK: store float {{.*}} !dbg [[DBG_FOO_COMPLEX:!.*]]
{
}
// CHECK: [[DBG_F1]] = metadata !{i32 100,
// CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200,
-// CHECK: [[DBG_FOO_REF]] = metadata !{i32 202,
+// CHECK: [[DBG_FOO_REF]] = metadata !{i32 203,
+// CHECK: [[DBG_FOO_COMPLEX]] = metadata !{i32 206,