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,
373373 attrs = attrs.addParamAttributes (IGM.getLLVMContext (), paramIndex, b);
374374}
375375
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.
376379CombinedResultAndErrorType irgen::combineResultAndTypedErrorType (
377380 const IRGenModule &IGM, const NativeConventionSchema &resultSchema,
378381 const NativeConventionSchema &errorSchema) {
382+ assert (!resultSchema.requiresIndirect ());
383+ assert (!errorSchema.shouldReturnTypedErrorIndirectly ());
384+
379385 CombinedResultAndErrorType result;
380386 SmallVector<llvm::Type *, 8 > elts;
381387 resultSchema.enumerateComponents (
@@ -403,6 +409,8 @@ CombinedResultAndErrorType irgen::combineResultAndTypedErrorType(
403409 }
404410
405411 auto *error = *errorIt;
412+ assert (error->isIntOrPtrTy () &&
413+ " Direct errors must only consist of int or ptr values" );
406414 result.errorValueMapping .push_back (combined.size ());
407415 if (res->getPrimitiveSizeInBits () >= error->getPrimitiveSizeInBits ()) {
408416 combined.push_back (res);
You can’t perform that action at this time.
0 commit comments