@@ -176,33 +176,39 @@ bool CIRGenModule::tryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
176
176
return false ;
177
177
}
178
178
179
- static void emitDeclInit (CIRGenFunction &CGF , const VarDecl *D ,
180
- Address DeclPtr ) {
181
- assert ((D ->hasGlobalStorage () ||
182
- (D ->hasLocalStorage () &&
183
- CGF .getContext ().getLangOpts ().OpenCLCPlusPlus )) &&
179
+ static void emitDeclInit (CIRGenFunction &cgf , const VarDecl *varDecl ,
180
+ Address declPtr ) {
181
+ assert ((varDecl ->hasGlobalStorage () ||
182
+ (varDecl ->hasLocalStorage () &&
183
+ cgf .getContext ().getLangOpts ().OpenCLCPlusPlus )) &&
184
184
" VarDecl must have global or local (in the case of OpenCL) storage!" );
185
- assert (!D ->getType ()->isReferenceType () &&
185
+ assert (!varDecl ->getType ()->isReferenceType () &&
186
186
" Should not call emitDeclInit on a reference!" );
187
187
188
- QualType type = D ->getType ();
189
- LValue lv = CGF .makeAddrLValue (DeclPtr , type);
188
+ QualType type = varDecl ->getType ();
189
+ LValue lv = cgf .makeAddrLValue (declPtr , type);
190
190
191
- const Expr *Init = D ->getInit ();
191
+ const Expr *init = varDecl ->getInit ();
192
192
switch (CIRGenFunction::getEvaluationKind (type)) {
193
+ case cir::TEK_Scalar:
194
+ if (lv.isObjCStrong ())
195
+ llvm_unreachable (" NYI" );
196
+ else if (lv.isObjCWeak ())
197
+ llvm_unreachable (" NYI" );
198
+ else
199
+ cgf.emitScalarInit (init, cgf.getLoc (varDecl->getLocation ()), lv, false );
200
+ return ;
201
+ case cir::TEK_Complex:
202
+ llvm_unreachable (" complext evaluation NYI" );
193
203
case cir::TEK_Aggregate:
194
- CGF .emitAggExpr (Init ,
204
+ cgf .emitAggExpr (init ,
195
205
AggValueSlot::forLValue (lv, AggValueSlot::IsDestructed,
196
206
AggValueSlot::DoesNotNeedGCBarriers,
197
207
AggValueSlot::IsNotAliased,
198
208
AggValueSlot::DoesNotOverlap));
199
209
return ;
200
- case cir::TEK_Scalar:
201
- CGF.emitScalarInit (Init, CGF.getLoc (D->getLocation ()), lv, false );
202
- return ;
203
- case cir::TEK_Complex:
204
- llvm_unreachable (" complext evaluation NYI" );
205
210
}
211
+ llvm_unreachable (" bad evaluation kind" );
206
212
}
207
213
208
214
static void emitDeclDestroy (CIRGenFunction &CGF, const VarDecl *D) {
@@ -336,7 +342,7 @@ void CIRGenModule::emitCXXGlobalVarDeclInit(const VarDecl *varDecl,
336
342
337
343
assert (varDecl && " Expected a global declaration!" );
338
344
CIRGenFunction cgf{*this , builder, true };
339
- llvm::SaveAndRestore<CIRGenFunction*> savedCGF (CurCGF, &cgf);
345
+ llvm::SaveAndRestore<CIRGenFunction *> savedCGF (CurCGF, &cgf);
340
346
CurCGF->CurFn = addr;
341
347
342
348
CIRGenFunction::SourceLocRAIIObject fnLoc{cgf,
0 commit comments