MCPcopy Create free account
hub / github.com/beefytech/Beef / DbgFinish

Method DbgFinish

IDEHelper/Compiler/BfModule.cpp:27038–27118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27036}
27037
27038void BfModule::DbgFinish()
27039{
27040 if ((mBfIRBuilder == NULL) || (mExtensionCount != 0))
27041 return;
27042
27043 if (mAwaitingInitFinish)
27044 FinishInit();
27045
27046 if (mHasForceLinkMarker)
27047 return;
27048
27049 String markerName;
27050 BfIRValue linkMarker;
27051
27052 if (mBfIRBuilder->DbgHasInfo())
27053 {
27054 bool needForceLinking = false;
27055 if (WantsDebugHelpers())
27056 {
27057 for (auto& ownedType : mOwnedTypeInstances)
27058 {
27059 bool hasConfirmedReference = false;
27060 for (auto& methodInstGroup : ownedType->mMethodInstanceGroups)
27061 {
27062 if ((methodInstGroup.IsImplemented()) && (methodInstGroup.mDefault != NULL) &&
27063 (!methodInstGroup.mDefault->mMethodDef->mIsStatic) && (methodInstGroup.mDefault->mIsReified) && (!methodInstGroup.mDefault->mAlwaysInline) &&
27064 ((methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_AlwaysInclude) || (methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_Referenced)) &&
27065 (methodInstGroup.mHasEmittedReference))
27066 {
27067 hasConfirmedReference = true;
27068 }
27069 }
27070 if ((!hasConfirmedReference) || (ownedType->IsBoxed()))
27071 needForceLinking = true;
27072 }
27073 }
27074
27075 if ((needForceLinking) && (mProject->mCodeGenOptions.mAsmKind == BfAsmKind_None))
27076 {
27077 BfMethodState methodState;
27078 SetAndRestoreValue<BfMethodState*> prevMethodState(mCurMethodState, &methodState);
27079 methodState.mTempKind = BfMethodState::TempKind_Static;
27080
27081 mHasForceLinkMarker = true;
27082
27083 auto voidType = mBfIRBuilder->MapType(GetPrimitiveType(BfTypeCode_None));
27084 SizedArray<BfIRType, 0> paramTypes;
27085 BfIRFunctionType funcType = mBfIRBuilder->CreateFunctionType(voidType, paramTypes);
27086 String linkName = "FORCELINKMOD_" + mModuleName;
27087 BfIRFunction func = mBfIRBuilder->CreateFunction(funcType, BfIRLinkageType_External, linkName);
27088 mBfIRBuilder->SetActiveFunction(func);
27089 auto entryBlock = mBfIRBuilder->CreateBlock("main", true);
27090 mBfIRBuilder->SetInsertPoint(entryBlock);
27091
27092 auto firstType = mOwnedTypeInstances[0];
27093
27094 UpdateSrcPos(mContext->mBfObjectType->mTypeDef->GetRefNode());
27095 SizedArray<BfIRMDNode, 1> diParamTypes;

Callers

nothing calls this directly

Calls 15

BfIRFunctionClass · 0.85
DbgHasInfoMethod · 0.80
IsImplementedMethod · 0.80
MapTypeMethod · 0.80
DbgGetTypeMethod · 0.80
DbgCreateFunctionMethod · 0.80
DbgCreateAutoVariableMethod · 0.80
DbgInsertDeclareMethod · 0.80
IsBoxedMethod · 0.45
CreateFunctionTypeMethod · 0.45
CreateFunctionMethod · 0.45

Tested by

no test coverage detected