| 2041 | } |
| 2042 | |
| 2043 | void BfModule::RestoreScopeState() |
| 2044 | { |
| 2045 | BfScopeData* prevScopeData = mCurMethodState->mCurScope->mPrevScope; |
| 2046 | mCurMethodState->mBlockNestLevel--; |
| 2047 | |
| 2048 | if (!mCurMethodState->mCurScope->mAtEndBlocks.empty()) |
| 2049 | { |
| 2050 | BfIRBlock afterEndBlock; |
| 2051 | if (!mCurMethodState->mLeftBlockUncond) |
| 2052 | { |
| 2053 | afterEndBlock = mBfIRBuilder->CreateBlock("scopeAfterEnd"); |
| 2054 | mBfIRBuilder->CreateBr(afterEndBlock); |
| 2055 | mBfIRBuilder->ClearDebugLocation_Last(); |
| 2056 | } |
| 2057 | |
| 2058 | for (auto preExitBlock : mCurMethodState->mCurScope->mAtEndBlocks) |
| 2059 | mBfIRBuilder->MoveBlockToEnd(preExitBlock); |
| 2060 | |
| 2061 | if (afterEndBlock) |
| 2062 | { |
| 2063 | mBfIRBuilder->AddBlock(afterEndBlock); |
| 2064 | mBfIRBuilder->SetInsertPoint(afterEndBlock); |
| 2065 | } |
| 2066 | } |
| 2067 | |
| 2068 | mCurMethodState->mCurScope->mDone = true; |
| 2069 | if (!mCurMethodState->mLeftBlockUncond) |
| 2070 | EmitDeferredScopeCalls(true, mCurMethodState->mCurScope); |
| 2071 | |
| 2072 | EmitDeferredCallProcessorInstances(mCurMethodState->mCurScope); |
| 2073 | |
| 2074 | RestoreScoreState_LocalVariables(mCurMethodState->mCurScope->mLocalVarStart); |
| 2075 | |
| 2076 | if (mCurMethodState->mCurScope->mValueScopeStart) |
| 2077 | mBfIRBuilder->CreateValueScopeHardEnd(mCurMethodState->mCurScope->mValueScopeStart); |
| 2078 | |
| 2079 | mCurMethodState->mCurScope = prevScopeData; |
| 2080 | mCurMethodState->mTailScope = mCurMethodState->mCurScope; |
| 2081 | } |
| 2082 | |
| 2083 | BfIRValue BfModule::CreateAlloca(BfIRType irType, int align, bool addLifetime, const char* name, BfIRValue arraySize) |
| 2084 | { |
no test coverage detected