File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -373,9 +373,15 @@ static void addIndirectResultAttributes(IRGenModule &IGM,
373
373
attrs = attrs.addParamAttributes (IGM.getLLVMContext (), paramIndex, b);
374
374
}
375
375
376
+ // This function should only be called with directly returnable
377
+ // result and error types. Errors can only be returned directly if
378
+ // they consists solely of int and ptr values.
376
379
CombinedResultAndErrorType irgen::combineResultAndTypedErrorType (
377
380
const IRGenModule &IGM, const NativeConventionSchema &resultSchema,
378
381
const NativeConventionSchema &errorSchema) {
382
+ assert (!resultSchema.requiresIndirect ());
383
+ assert (!errorSchema.shouldReturnTypedErrorIndirectly ());
384
+
379
385
CombinedResultAndErrorType result;
380
386
SmallVector<llvm::Type *, 8 > elts;
381
387
resultSchema.enumerateComponents (
@@ -403,6 +409,8 @@ CombinedResultAndErrorType irgen::combineResultAndTypedErrorType(
403
409
}
404
410
405
411
auto *error = *errorIt;
412
+ assert (error->isIntOrPtrTy () &&
413
+ " Direct errors must only consist of int or ptr values" );
406
414
result.errorValueMapping .push_back (combined.size ());
407
415
if (res->getPrimitiveSizeInBits () >= error->getPrimitiveSizeInBits ()) {
408
416
combined.push_back (res);
You can’t perform that action at this time.
0 commit comments