diff --git a/BeefBoot/BeefBoot.cpp b/BeefBoot/BeefBoot.cpp index db502e6f..7b8e6ef4 100644 --- a/BeefBoot/BeefBoot.cpp +++ b/BeefBoot/BeefBoot.cpp @@ -32,7 +32,7 @@ using namespace Beefy; BF_IMPORT void BF_CALLTYPE Debugger_ProgramDone(); int main(int argc, char* argv[]) -{ +{ #ifdef TEST_CRASH CrashCatcher catcher; catcher.SetCrashReportKind(BfpCrashReportKind_GUI); diff --git a/BeefBoot/BootApp.cpp b/BeefBoot/BootApp.cpp index 78596e90..219b7f15 100644 --- a/BeefBoot/BootApp.cpp +++ b/BeefBoot/BootApp.cpp @@ -763,7 +763,11 @@ void BootApp::DoLinkGNU() linkLine.Append(" "); linkLine.Append("-g "); - linkLine.Append("-debug -no-pie "); + linkLine.Append("-debug "); +#ifdef BF_PLATFORM_LINUX + linkLine.Append("-no-pie "); +#endif + linkLine.Append(mLinkParams); auto runCmd = QueueRun(linkerPath, linkLine, mWorkingDir, BfpSpawnFlag_UseArgsFile); diff --git a/BeefySysLib/util/BeefPerf.cpp b/BeefySysLib/util/BeefPerf.cpp index 6f8192f3..d2b7ec2e 100644 --- a/BeefySysLib/util/BeefPerf.cpp +++ b/BeefySysLib/util/BeefPerf.cpp @@ -17,7 +17,7 @@ typedef fd_set FD_SET; #define closesocket close #endif -#ifdef BF_PLATFORM_OSX +#ifdef BF_PLATFORM_MACOS #include #include #include diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf index ae95d8c7..ac22c1ff 100644 --- a/IDE/src/BuildContext.bf +++ b/IDE/src/BuildContext.bf @@ -38,6 +38,18 @@ namespace IDE Failed } + Workspace.PlatformType mPlatformType; + Workspace.ToolsetType mToolset; + int mPtrSize; + + public this() + { + Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions(); + mToolset = workspaceOptions.mToolsetType; + mPlatformType = Workspace.PlatformType.GetFromName(gApp.mPlatformName); + mPtrSize = Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName); + } + public CustomBuildCommandResult QueueProjectCustomBuildCommands(Project project, String targetPath, Project.BuildCommandTrigger trigger, List cmdList) { if (cmdList.IsEmpty) @@ -186,7 +198,8 @@ namespace IDE linkLine.Append("-mwindows "); } - linkLine.Append("-no-pie "); + if (mPlatformType == .Linux) + linkLine.Append("-no-pie "); linkLine.Append(objectsArg); @@ -204,7 +217,7 @@ namespace IDE String[] mingwFiles; String fromDir; - if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) + if (mPtrSize == 4) { fromDir = scope:: String(llvmDir, "i686-w64-mingw32/bin/"); mingwFiles = scope:: String[] { "libgcc_s_dw2-1.dll", "libstdc++-6.dll" }; @@ -298,7 +311,7 @@ namespace IDE if (workspaceOptions.mToolsetType == .GNU) { - if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) + if (mPtrSize == 4) { } else @@ -311,7 +324,7 @@ namespace IDE } else // Microsoft { - if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) + if (mPtrSize == 4) { //linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" "); for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths) @@ -411,33 +424,11 @@ namespace IDE outDbg.Append("_d"); outDbg.Append(dynName ? ".dll" : ".lib"); } - - /*if ((workspaceOptions.mEnableObjectDebugFlags) && - ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))) - { - outDbg.Append("Beef", IDEApp.sRTVersionStr, "Dbg"); - outDbg.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64"); - switch (options.mBuildOptions.mBeefLibType) - { - case .Dynamic: - case .DynamicDebug: outDbg.Append("_d"); - case .Static: - switch (options.mBuildOptions.mCLibType) - { - case .None: - case .Dynamic, .SystemMSVCRT: outDbg.Append("_s"); - case .DynamicDebug: outDbg.Append("_sd"); - case .Static: outDbg.Append("_ss"); - case .StaticDebug: outDbg.Append("_ssd"); - } - } - outDbg.Append(dynName ? ".dll" : ".lib"); - }*/ } bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg) { - bool is64Bit = Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 8; + bool is64Bit = mPtrSize == 8; String llvmDir = scope String(IDEApp.sApp.mInstallDir); IDEUtils.FixFilePath(llvmDir); @@ -1060,7 +1051,12 @@ namespace IDE } else // MS { - if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg)) + if (mPlatformType != .Windows) + { + gApp.OutputErrorLine("Project '{}' cannot be linked with the Windows Toolset for platform '{}'", project.mProjectName, mPlatformType); + return false; + } + else if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg)) return false; } diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 761950e9..b3905f8a 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -107,7 +107,7 @@ namespace IDE #elif BF_PLATFORM_LINUX public static readonly String sPlatform64Name = "Linux64"; public static readonly String sPlatform32Name = "Linux32"; -#elif BF_PLATFORM_OSX +#elif BF_PLATFORM_MACOS public static readonly String sPlatform64Name = "macOS"; public static readonly String sPlatform32Name = null; #else @@ -8358,17 +8358,24 @@ namespace IDE if (!DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString)) return false; -#if BF_PLATFORM_WINDOWS - if (project.mGeneralOptions.mTargetType == .BeefLib) - newString.Append(".lib"); - else if (project.mGeneralOptions.mTargetType == .BeefDynLib) - newString.Append(".dll"); - else if (project.mGeneralOptions.mTargetType != .CustomBuild) - newString.Append(".exe"); -#else - if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib) - newString.Append(".so"); -#endif + + let platformType = Workspace.PlatformType.GetFromName(platformName); + switch (platformType) + { + case .Windows: + if (project.mGeneralOptions.mTargetType == .BeefLib) + newString.Append(".lib"); + else if (project.mGeneralOptions.mTargetType == .BeefDynLib) + newString.Append(".dll"); + else if (project.mGeneralOptions.mTargetType != .CustomBuild) + newString.Append(".exe"); + case .macOS: + if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib) + newString.Append(".dylib"); + default: + if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib) + newString.Append(".so"); + } } case "ProjectDir": if (project.IsDebugSession) @@ -8390,24 +8397,33 @@ namespace IDE (project.mGeneralOptions.mTargetType == .BeefDynLib) || ((options.mBuildOptions.mBuildKind == .Test) && (project == mWorkspace.mStartupProject))) { -#if BF_PLATFORM_WINDOWS - String rtName = scope String(); - String dbgName = scope String(); - BuildContext.GetRtLibNames(workspaceOptions, options, false, rtName, dbgName); - newString.Append(rtName); - if (!dbgName.IsEmpty) - newString.Append(" ", dbgName); - switch (workspaceOptions.mAllocType) + + let platformType = Workspace.PlatformType.GetFromName(platformName); + switch (platformType) { - case .JEMalloc: - newString.Append(" jemalloc.lib"); - case .TCMalloc: - newString.Append(" tcmalloc.lib"); + case .Windows: + String rtName = scope String(); + String dbgName = scope String(); + BuildContext.GetRtLibNames(workspaceOptions, options, false, rtName, dbgName); + newString.Append(rtName); + if (!dbgName.IsEmpty) + newString.Append(" ", dbgName); + switch (workspaceOptions.mAllocType) + { + case .JEMalloc: + newString.Append(" jemalloc.lib"); + case .TCMalloc: + newString.Append(" tcmalloc.lib"); + default: + } + case .macOS: + newString.Append("./libBeefRT_d.dylib -Wl,-rpath -Wl,."); + case .iOS: + case .Linux: + newString.Append("./libBeefRT_d.so -Wl,-rpath -Wl,$ORIGIN"); default: - } -#else - newString.Append("./libBeefRT_d.so -Wl,-rpath -Wl,."); -#endif + } + } case "VSToolPath": if (Workspace.PlatformType.GetPtrSizeByName(platformName) == 4) @@ -9255,6 +9271,9 @@ namespace IDE { canCompile = false; } + + //TODO: + canCompile = true; if (!canCompile) { diff --git a/IDE/src/SpellChecker.bf b/IDE/src/SpellChecker.bf index 6cc7df75..059ba5ae 100644 --- a/IDE/src/SpellChecker.bf +++ b/IDE/src/SpellChecker.bf @@ -99,7 +99,7 @@ namespace IDE { String fileName = scope String(); GetUserDirectFileName(fileName); - File.WriteAllLines(fileName, mCustomDictionaryWordList.GetEnumerator()); + File.WriteAllLines(fileName, mCustomDictionaryWordList.GetEnumerator()).IgnoreError(); } diff --git a/IDE/src/Workspace.bf b/IDE/src/Workspace.bf index 893f9d34..2507d5d5 100644 --- a/IDE/src/Workspace.bf +++ b/IDE/src/Workspace.bf @@ -20,31 +20,13 @@ namespace IDE ObjectAndIRCode } - public enum MachineType - { - case x86; - case x64; - - public int32 PtrSize - { - get - { - switch (this) - { - case .x86: - return 4; - case .x64: - return 8; - } - } - } - } - public enum PlatformType { case Unknown; case Windows; case Linux; + case macOS; + case iOS; public static PlatformType GetFromName(String name) { @@ -52,6 +34,8 @@ namespace IDE { case "Win32", "Win64": return .Windows; case "Linux32", "Linux64": return .Linux; + case "macOS": return .macOS; + case "iOS": return .iOS; default: return .Unknown; } } @@ -66,6 +50,10 @@ namespace IDE return .Linux; #endif +#if BF_PLATFORM_MACOS + return .Linux; +#endif + #unwarn return .Unknown; } @@ -585,6 +573,9 @@ namespace IDE { var options = platformKeyValue.value; var platformName = platformKeyValue.key; + + let platformType = PlatformType.GetFromName(platformName); + using (data.CreateObject(platformName)) { using (data.CreateArray("PreprocessorMacros")) @@ -597,11 +588,10 @@ namespace IDE data.ConditionalAdd("Toolset", options.mToolsetType, ToolsetType.Default); data.ConditionalAdd("BuildKind", options.mBuildKind, isTest ? .Test : .Normal); data.ConditionalAdd("BfSIMDSetting", options.mBfSIMDSetting, .SSE2); -#if BF_PLATFORM_WINDOWS - data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0); -#else - data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : .O0); -#endif + if (platformType == .Windows) + data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0); + else + data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : .O0); data.ConditionalAdd("LTOType", options.mLTOType, .None); data.ConditionalAdd("AllocType", options.mAllocType, isRelease ? .CRT : .Debug); data.ConditionalAdd("AllocMalloc", options.mAllocMalloc, ""); @@ -705,15 +695,19 @@ namespace IDE #unwarn bool isParanoid = configName.Contains("Paranoid"); bool isTest = configName.Contains("Test"); + let platformType = PlatformType.GetFromName(platformName); options.mBfSIMDSetting = .SSE2; -#if BF_PLATFORM_WINDOWS - options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0; - options.mToolsetType = .Microsoft; -#else - options.mBfOptimizationLevel = isRelease ? .O2 : .O0; - options.mToolsetType = .GNU; -#endif + if (platformType == .Windows) + { + options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0; + options.mToolsetType = .Microsoft; + } + else + { + options.mBfOptimizationLevel = isRelease ? .O2 : .O0; + options.mToolsetType = .GNU; + } options.mAllocType = isRelease ? .CRT : .Debug; options.mEmitDebugInfo = .Yes; @@ -726,13 +720,16 @@ namespace IDE options.mEnableObjectDebugFlags = !isRelease; options.mEmitObjectAccessCheck = !isRelease; -#if BF_PLATFORM_WINDOWS - options.mEnableRealtimeLeakCheck = !isRelease; - options.mEnableSideStack = isParanoid; -#else - options.mEnableRealtimeLeakCheck = false; - options.mEnableSideStack = false; -#endif + if (platformType == .Windows) + { + options.mEnableRealtimeLeakCheck = !isRelease; + options.mEnableSideStack = isParanoid; + } + else + { + options.mEnableRealtimeLeakCheck = false; + options.mEnableSideStack = false; + } options.mAllowHotSwapping = !isRelease; options.mIncrementalBuild = !isRelease; @@ -784,6 +781,7 @@ namespace IDE { Options options = new Options(); let platformName = new String(platformNameKey); + let platformType = PlatformType.GetFromName(platformName); config.mPlatforms[platformName] = options; SetupDefault(options, configName, platformName); @@ -798,11 +796,11 @@ namespace IDE options.mToolsetType = data.GetEnum("Toolset", ToolsetType.Default); options.mBuildKind = data.GetEnum("BuildKind", isTest ? .Test : .Normal); options.mBfSIMDSetting = data.GetEnum("BfSIMDSetting", .SSE2); -#if BF_PLATFORM_WINDOWS - options.mBfOptimizationLevel = data.GetEnum("BfOptimizationLevel", isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0); -#else - options.mBfOptimizationLevel = data.GetEnum("BfOptimizationLevel", isRelease ? .O2 : .O0); -#endif + if (platformType == .Windows) + options.mBfOptimizationLevel = data.GetEnum("BfOptimizationLevel", isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0); + else + options.mBfOptimizationLevel = data.GetEnum("BfOptimizationLevel", isRelease ? .O2 : .O0); + options.mLTOType = data.GetEnum("LTOType", .None); options.mAllocType = data.GetEnum("AllocType", isRelease ? .CRT : .Debug); data.GetString("AllocMalloc", options.mAllocMalloc); diff --git a/IDE/src/ui/WorkspaceProperties.bf b/IDE/src/ui/WorkspaceProperties.bf index 4b624da5..e8546932 100644 --- a/IDE/src/ui/WorkspaceProperties.bf +++ b/IDE/src/ui/WorkspaceProperties.bf @@ -494,7 +494,6 @@ namespace IDE.ui var (category, propEntry) = AddPropertiesItem(root, "General"); category.mIsBold = true; category.mTextColor = cHeaderColor; - AddPropertiesItem(category, "Machine Type", "mMachineType"); AddPropertiesItem(category, "Toolset", "mToolsetType"); AddPropertiesItem(category, "Build Type", "mBuildKind"); diff --git a/IDEHelper/COFF.cpp b/IDEHelper/COFF.cpp index 314407a9..c75e42fb 100644 --- a/IDEHelper/COFF.cpp +++ b/IDEHelper/COFF.cpp @@ -4717,9 +4717,9 @@ bool COFF::CvParseDBI(int wantAge) uint8* data = CvReadStream(3); uint8* sectionData = data; defer - { + ( delete sectionData; - }; + ); // Header GET_INTO(int32, signature); @@ -5578,22 +5578,7 @@ bool COFF::ParseCv(DataStream& pdbFS, uint8* rootDirData, int pageSize, uint8 wa if (mParseKind == ParseKind_Header) return true; - //ParseSymbolData(); - - //TODO: Remove - /*for (int streamIdx = 0; streamIdx < numStreams; streamIdx++) - { - int outSize; - uint8* data = CvReadStream(streamIdx, &outSize); - if (outSize > 0) - { - FILE* fp = fopen(StrFormat("c:/temp/test4/pdb_stream_%d.bin", streamIdx).c_str(), "wb"); - fwrite(data, 1, outSize, fp); - fclose(fp); - delete [] data; - } - }*/ - + /// { BP_ZONE("COFF::ParseCv_ReadStrTable"); if (mStringTable.mStream != -1) @@ -5604,28 +5589,12 @@ bool COFF::ParseCv(DataStream& pdbFS, uint8* rootDirData, int pageSize, uint8 wa } for (int compileUnitId = 0; compileUnitId < (int)mCvModuleInfo.size(); compileUnitId++) - { - //ParseCompileUnit(compileUnitId); + { ScanCompileUnit(compileUnitId); } - /*for (int streamIdx = 0; streamIdx < (int)mDeferredModuleInfo.size(); streamIdx++) - { - if (mDeferredModuleInfo[streamIdx].empty()) - continue; - - uint8* data = CvReadStream(streamIdx); - uint8* sectionData = data; - - for (auto& moduleInfo : mDeferredModuleInfo[streamIdx]) - { - CvParseModuleInfo(*moduleInfo, data, sectionData, mCvTypeSectionData, mStringTable); - } - }*/ - ////////////////////////////////////////////////////////////////////////// - - + return true; } @@ -5764,9 +5733,6 @@ bool COFF::TryLoadPDB(const String& pdbPath, uint8 wantGuid[16], int32 wantAge) return false; } - //FixTypes(startingTypeIdx); - //MapTypes(startingTypeIdx); - if (mCvDataStream->mFailed) return false; @@ -5928,24 +5894,13 @@ void COFF::ProcessDebugInfo() GET_INTO(uint32, infoType); BF_ASSERT(infoType == CV_SIGNATURE_C13); - CvInitStreamRaw(mCvTypeSectionReader, entry.mData + 4, entry.mSize - 4); - //ParseTypeData(data, mCvTypeSectionDataSize - sizeof(uint32)); + CvInitStreamRaw(mCvTypeSectionReader, entry.mData + 4, entry.mSize - 4); ParseTypeData(mCvTypeSectionReader, 0); } FixTypes(startingTypeIdx); linkedModule->MapTypes(startingTypeIdx); - /*std::unordered_set - for (int typeIdx = startingTypeIdx; typeIdx < (int)mTypes.size(); typeIdx++) - { - DbgType* dbgType = linkedModule->mTypes[typeIdx]; - if ((!dbgType->mIsDeclaration) && (dbgType->IsCompositeType())) - { - - } - }*/ - CvCompileUnit* compileUnit = NULL; for (auto entry : mCvCompileUnitData) { diff --git a/IDEHelper/Compiler/BfCodeGen.cpp b/IDEHelper/Compiler/BfCodeGen.cpp index e303ae6f..0b2262f6 100644 --- a/IDEHelper/Compiler/BfCodeGen.cpp +++ b/IDEHelper/Compiler/BfCodeGen.cpp @@ -377,7 +377,7 @@ void BfCodeGenThread::RunLoop() { #ifdef BF_PLATFORM_WINDOWS BeIRCodeGen* beIRCodeGen = new BeIRCodeGen(); - defer { delete beIRCodeGen; }; + defer ( delete beIRCodeGen; ); beIRCodeGen->SetConfigConst(BfIRConfigConst_VirtualMethodOfs, request->mOptions.mVirtualMethodOfs); beIRCodeGen->SetConfigConst(BfIRConfigConst_DynSlotOfs, request->mOptions.mDynSlotOfs); diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index c22dab2a..d8dd0d40 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -5709,7 +5709,7 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp } } - OnScopeExit doRestoreAutocomplete([&]() + defer( { if ((restoreCapturingMethodMatchInfo != NULL) && (autoComplete->mMethodMatchInfo == restoreCapturingMethodMatchInfo)) autoComplete->mIsCapturingMethodMatchInfo = true; @@ -9365,10 +9365,12 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam } defer - { - if (autoComplete != NULL) - autoComplete->mIsCapturingMethodMatchInfo = (wasCapturingMethodInfo) && (!autoComplete->mIsCapturingMethodMatchInfo); - }; + ( + { + if (autoComplete != NULL) + autoComplete->mIsCapturingMethodMatchInfo = (wasCapturingMethodInfo) && (!autoComplete->mIsCapturingMethodMatchInfo); + } + ); if (lambdaBindExpr->mBody == NULL) { @@ -11848,11 +11850,13 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo SizedArray args; SizedArray argExprEvaluators; - OnScopeExit freeMem([&]() - { - for (auto exprEvaluator : argExprEvaluators) - delete exprEvaluator; - }); + defer + ( + { + for (auto exprEvaluator : argExprEvaluators) + delete exprEvaluator; + } + ); auto _AddArg = [&](BfExpression* argExpr) { @@ -12155,11 +12159,14 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo prevSymbolRefKind = mModule->mCompiler->mResolvePassData->mGetSymbolReferenceKind; mModule->mCompiler->mResolvePassData->mGetSymbolReferenceKind = BfGetSymbolReferenceKind_None; } + defer - { - if (mModule->mCompiler->mResolvePassData != NULL) - mModule->mCompiler->mResolvePassData->mGetSymbolReferenceKind = prevSymbolRefKind; - }; + ( + { + if (mModule->mCompiler->mResolvePassData != NULL) + mModule->mCompiler->mResolvePassData->mGetSymbolReferenceKind = prevSymbolRefKind; + } + ); auto methodDef = methodInstance->mMethodDef; auto methodDeclaration = methodDef->GetMethodDeclaration(); @@ -15142,14 +15149,14 @@ void BfExprEvaluator::DoMemberReference(BfMemberReferenceExpression* memberRefEx findName = memberRefExpr->mMemberName->ToString(); defer - { + ( if (attributeState.mCustomAttributes != NULL) { if (mPropDef != NULL) attributeState.mTarget = BfAttributeTargets_Invocation; mModule->ValidateCustomAttributes(attributeState.mCustomAttributes, attributeState.mTarget); - } - }; + } + ); SetAndRestoreValue prevAttributeState(mModule->mAttributeState, &attributeState); @@ -15451,11 +15458,12 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr) wasCapturingMethodMatchInfo = autoComplete->mIsCapturingMethodMatchInfo; autoComplete->mIsCapturingMethodMatchInfo = false; } + defer - { + ( if (autoComplete != NULL) autoComplete->mIsCapturingMethodMatchInfo = wasCapturingMethodMatchInfo; - }; + ); if ((!isFailurePass) && (!methodMatcher.WantsCheckMethod(protectionCheckFlags, startCheckTypeInst, curCheckType, checkMethod))) continue; diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index a64fd209..bf33c415 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -4013,7 +4013,7 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen PopulateModulePassManager(PM, codeGenOptions); llvm::raw_fd_ostream* outStream = NULL; - defer{ delete outStream; }; + defer ( delete outStream; ); if (enableLTO) { diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index d0ee0a5f..2e437627 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -956,31 +956,6 @@ void BfModule::FinishInit() mBfIRBuilder->Module_SetTargetTriple(mCompiler->mOptions.mTargetTriple); -// #ifdef BF_PLATFORM_WINDOWS -// if (mCompiler->mOptions.mToolsetType == BfToolsetType_GNU) -// { -// if (mCompiler->mOptions.mMachineType == BfMachineType_x86) -// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-gnu"); -// else -// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-gnu"); -// } -// else //if (mCompiler->mOptions.mToolsetType == BfToolsetType_Microsoft) -// { -// if (mCompiler->mOptions.mMachineType == BfMachineType_x86) -// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-msvc"); -// else -// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-msvc"); -// } -// #elif defined BF_PLATFORM_LINUX -// if (mCompiler->mOptions.mMachineType == BfMachineType_x86) -// mBfIRBuilder->Module_SetTargetTriple("i686-unknown-linux-gnu"); -// else -// mBfIRBuilder->Module_SetTargetTriple("x86_64-unknown-linux-gnu"); -// #else -// // Leave it default -// mBfIRBuilder->Module_SetTargetTriple(""); -// #endif - mBfIRBuilder->SetBackend(IsTargetingBeefBackend()); if (moduleOptions.mOptLevel == BfOptLevel_OgPlus) @@ -991,15 +966,6 @@ void BfModule::FinishInit() mHasFullDebugInfo = moduleOptions.mEmitDebugInfo == 1; - // We need to create DIBuilder for mIsSpecialModule so we have it around when we need it -// if ((!mCompiler->mIsResolveOnly) && ((mIsScratchModule) || (moduleOptions.mEmitDebugInfo != 0))) -// { -// BF_ASSERT((!mBfIRBuilder->mIgnoreWrites) || (mIsScratchModule) || (!mIsReified)); -// mBfIRBuilder->DbgInit(); -// } -// else -// mHasFullDebugInfo = false; - if ((!mCompiler->mIsResolveOnly) && (!mIsScratchModule) && (moduleOptions.mEmitDebugInfo != 0) && (mIsReified)) { mBfIRBuilder->DbgInit(); diff --git a/IDEHelper/Compiler/BfStmtEvaluator.cpp b/IDEHelper/Compiler/BfStmtEvaluator.cpp index ae1203f4..0db435be 100644 --- a/IDEHelper/Compiler/BfStmtEvaluator.cpp +++ b/IDEHelper/Compiler/BfStmtEvaluator.cpp @@ -2505,10 +2505,10 @@ BfTypedValue BfModule::TryCaseEnumMatch(BfTypedValue enumVal, BfTypedValue tagVa } defer - { + ( if (autoComplete != NULL) autoComplete->mIsCapturingMethodMatchInfo = (wasCapturingMethodInfo) && (!autoComplete->mIsCapturingMethodMatchInfo); - }; + ); /// diff --git a/IDEHelper/DbgModule.cpp b/IDEHelper/DbgModule.cpp index 3b7ebc4d..91e3dff5 100644 --- a/IDEHelper/DbgModule.cpp +++ b/IDEHelper/DbgModule.cpp @@ -5319,10 +5319,10 @@ bool DbgModule::ReadCOFF(DataStream* stream, bool isHotObjectFile) mMemReporter->Add(mImageSize); } defer - { + ( if (mMemReporter != NULL) mMemReporter->EndSection(); - }; + ); DbgModule* mainModule = mDebugTarget->mTargetBinary; diff --git a/IDEHelper/VSSupport.cpp b/IDEHelper/VSSupport.cpp index 1bd639d1..f2bcf79c 100644 --- a/IDEHelper/VSSupport.cpp +++ b/IDEHelper/VSSupport.cpp @@ -123,6 +123,8 @@ void free_resources(Find_Result *result) { // Defer macro/thing. +#undef defer + #define CONCAT_INTERNAL(x,y) x##y #define CONCAT(x,y) CONCAT_INTERNAL(x,y) diff --git a/IDEHelper/WinDebugger.cpp b/IDEHelper/WinDebugger.cpp index b94bde0a..2bfcd205 100644 --- a/IDEHelper/WinDebugger.cpp +++ b/IDEHelper/WinDebugger.cpp @@ -11092,10 +11092,10 @@ String WinDebugger::DisassembleAtRaw(intptr inAddress) DbgModule* dbgModule = mDebugTarget->FindDbgModuleForAddress(address); DbgModuleMemoryCache* memCache = NULL; defer - { + ( if (dbgModule == NULL) delete memCache; - }; + ); if ((dbgModule != NULL) && (dbgModule->mOrigImageData == NULL)) dbgModule = NULL; diff --git a/bin/build.sh b/bin/build.sh index 204b9789..b01cb3f6 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -41,11 +41,11 @@ cmake --build . cd ../IDE/dist if [[ "$OSTYPE" == "darwin"* ]]; then - LIBEXT=dylib - LINKOPTS= + LIBEXT=dylib + LINKOPTS="-Wl,-rpath -Wl,." else LIBEXT=so - LINKOPTS=-ltinfo + LINKOPTS="-ltinfo -Wl,-rpath -Wl,\$ORIGIN" fi if [ ! -L libBeefRT_d.$LIBEXT ]; then @@ -61,7 +61,7 @@ fi ### DEBUG ### echo Building BeefBuild_bootd -../../jbuild_d/Debug/bin/BeefBoot --out="BeefBuild_bootd" --src=../src --src=../../BeefBuild/src --src=../../BeefLibs/corlib/src --src=../../BeefLibs/Beefy2D/src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="./libBeefRT_d.$LIBEXT ./libIDEHelper_d.$LIBEXT ./libBeefySysLib_d.$LIBEXT ../../extern/llvm_linux_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDemangle.a $LINKOPTS -Wl,-rpath -Wl,\$ORIGIN" +../../jbuild_d/Debug/bin/BeefBoot --out="BeefBuild_bootd" --src=../src --src=../../BeefBuild/src --src=../../BeefLibs/corlib/src --src=../../BeefLibs/Beefy2D/src --define=CLI --define=DEBUG --startup=BeefBuild.Program --linkparams="./libBeefRT_d.$LIBEXT ./libIDEHelper_d.$LIBEXT ./libBeefySysLib_d.$LIBEXT ../../extern/llvm_linux_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_8_0_0/lib/libLLVMDemangle.a $LINKOPTS" echo Building BeefBuild_d ./BeefBuild_bootd -clean -proddir=../../BeefBuild -config=Debug -platform=Linux64 #./BeefBuild_d -proddir=../../TestApp