1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Entry point fixes

This commit is contained in:
Brian Fiete 2022-02-07 14:26:15 -05:00
parent 114a90dd5e
commit d85f164b8a

View file

@ -1794,7 +1794,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
auto res = bfModule->mBfIRBuilder->CreateCall(mainFunc, args); auto res = bfModule->mBfIRBuilder->CreateCall(mainFunc, args);
args.clear(); args.clear();
bfModule->mBfIRBuilder->CreateCall(shutdownFunc, args); bfModule->mBfIRBuilder->CreateCall(shutdownFunc, args);
if (mainHasArgs) if (mainHasRet)
bfModule->mBfIRBuilder->CreateRet(res); bfModule->mBfIRBuilder->CreateRet(res);
else else
bfModule->mBfIRBuilder->CreateRetVoid(); bfModule->mBfIRBuilder->CreateRetVoid();
@ -1815,7 +1815,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
} }
} }
if ((mOptions.mPlatformType != BfPlatformType_Windows) && if ((mOptions.mPlatformType != BfPlatformType_Windows) && (mainHasArgs) &&
((targetType == BfTargetType_BeefConsoleApplication) || (targetType == BfTargetType_BeefTest))) ((targetType == BfTargetType_BeefConsoleApplication) || (targetType == BfTargetType_BeefTest)))
{ {
SmallVector<BfIRType, 2> paramTypes; SmallVector<BfIRType, 2> paramTypes;
@ -1827,11 +1827,8 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
bfModule->SetupIRMethod(NULL, setCmdLineFunc, false); bfModule->SetupIRMethod(NULL, setCmdLineFunc, false);
SmallVector<BfIRValue, 2> args; SmallVector<BfIRValue, 2> args;
if (mainHasArgs) args.push_back(bfModule->mBfIRBuilder->GetArgument(0));
{ args.push_back(bfModule->mBfIRBuilder->GetArgument(1));
args.push_back(bfModule->mBfIRBuilder->GetArgument(0));
args.push_back(bfModule->mBfIRBuilder->GetArgument(1));
}
bfModule->mBfIRBuilder->CreateCall(setCmdLineFunc, args); bfModule->mBfIRBuilder->CreateCall(setCmdLineFunc, args);
} }