Skip to content

Commit b420265

Browse files
committed
Address code review comments
1 parent d3e1d50 commit b420265

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
4949
}
5050
}
5151

52-
mlir::Location loc = getLoc(e->getExprLoc());
5352
switch (builtinID) {
5453
case Builtin::BI__builtin_complex: {
5554
mlir::Value real = emitScalarExpr(e->getArg(0));
5655
mlir::Value imag = emitScalarExpr(e->getArg(1));
5756
return RValue::getComplex(real, imag);
5857
}
59-
default:
60-
cgm.errorNYI(loc, "non constant foldable builtin calls");
6158
}
59+
60+
mlir::Location loc = getLoc(e->getExprLoc());
61+
cgm.errorNYI(loc, "non constant foldable builtin calls");
6262
return getUndefRValue(e->getType());
6363
}

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ mlir::Value ComplexExprEmitter::emitLoadOfLValue(LValue lv,
5252
SourceLocation loc) {
5353
assert(lv.isSimple() && "non-simple complex l-value?");
5454
if (lv.getType()->isAtomicType())
55-
cgf.cgm.errorNYI("emitLoadOfLValue with Atomic LV");
55+
cgf.cgm.errorNYI(loc, "emitLoadOfLValue with Atomic LV");
5656

5757
const Address srcAddr = lv.getAddress();
5858
return builder.createLoad(cgf.getLoc(loc), srcAddr);
@@ -62,7 +62,7 @@ void ComplexExprEmitter::emitStoreOfComplex(mlir::Location loc, mlir::Value val,
6262
LValue lv, bool isInit) {
6363
if (lv.getType()->isAtomicType() ||
6464
(!isInit && cgf.isLValueSuitableForInlineAtomic(lv))) {
65-
cgf.cgm.errorNYI("StoreOfComplex with Atomic LV");
65+
cgf.cgm.errorNYI(loc, "StoreOfComplex with Atomic LV");
6666
return;
6767
}
6868

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class RValue {
9696
er.isVolatile = false;
9797
return er;
9898
}
99-
10099
static RValue getComplex(const std::pair<mlir::Value, mlir::Value> &c) {
101100
return getComplex(c.first, c.second);
102101
}

clang/test/CIR/CodeGen/complex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ void foo8() {
191191
// OGCG: store double 0.000000e+00, ptr %[[C_REAL_PTR]], align 8
192192
// OGCG: store double 2.000000e+00, ptr %[[C_IMAG_PTR]], align 8
193193

194-
void foo9(double r, double i) {
195-
double _Complex c = __builtin_complex(r, i);
194+
void foo9(double a, double b) {
195+
double _Complex c = __builtin_complex(a, b);
196196
}
197197

198198
// CIR: %[[INIT:.*]] = cir.alloca !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>, ["c", init]

0 commit comments

Comments
 (0)