Skip to content

Commit d427779

Browse files
committed
Address review feedback
1 parent 389f3d9 commit d427779

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

clang/lib/CIR/CodeGen/CIRGenClass.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,17 @@ static void emitMemberInitializer(CIRGenFunction &cgf,
8686

8787
mlir::Value thisPtr = cgf.loadCXXThis();
8888
QualType recordTy = cgf.getContext().getTypeDeclType(classDecl);
89-
LValue lhs;
9089

9190
// If a base constructor is being emitted, create an LValue that has the
9291
// non-virtual alignment.
93-
if (cgf.curGD.getCtorType() == Ctor_Base)
94-
lhs = cgf.makeNaturalAlignPointeeAddrLValue(thisPtr, recordTy);
95-
else
96-
lhs = cgf.makeNaturalAlignAddrLValue(thisPtr, recordTy);
92+
LValue lhs = (cgf.curGD.getCtorType() == Ctor_Base) ?
93+
cgf.makeNaturalAlignPointeeAddrLValue(thisPtr, recordTy) :
94+
cgf.makeNaturalAlignAddrLValue(thisPtr, recordTy);
9795

9896
emitLValueForAnyFieldInitialization(cgf, memberInit, lhs);
9997

10098
// Special case: If we are in a copy or move constructor, and we are copying
101-
// an array off PODs or classes with tirival copy constructors, ignore the AST
99+
// an array off PODs or classes with trivial copy constructors, ignore the AST
102100
// and perform the copy we know is equivalent.
103101
// FIXME: This is hacky at best... if we had a bit more explicit information
104102
// in the AST, we could generalize it more easily.
@@ -205,12 +203,11 @@ void CIRGenFunction::emitInitializerForField(FieldDecl *field, LValue lhs,
205203
QualType fieldType = field->getType();
206204
switch (getEvaluationKind(fieldType)) {
207205
case cir::TEK_Scalar:
208-
if (lhs.isSimple()) {
206+
if (lhs.isSimple())
209207
emitExprAsInit(init, field, lhs, false);
210-
} else {
208+
else
211209
cgm.errorNYI(field->getSourceRange(),
212210
"emitInitializerForField: non-simple scalar");
213-
}
214211
break;
215212
case cir::TEK_Complex:
216213
cgm.errorNYI(field->getSourceRange(), "emitInitializerForField: complex");

0 commit comments

Comments
 (0)