mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
Use SCOPE_EXIT in DtoDefineFunction
This commit is contained in:
parent
e0685f8485
commit
6c4f421ead
1 changed files with 5 additions and 3 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "gen/dvalue.h"
|
||||
#include "gen/funcgenstate.h"
|
||||
#include "gen/function-inlining.h"
|
||||
#include "gen/helpers.h"
|
||||
#include "gen/inlineir.h"
|
||||
#include "gen/irstate.h"
|
||||
#include "gen/linkage.h"
|
||||
|
@ -909,6 +910,10 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
|
|||
IF_LOG Logger::println("Doing function body for: %s", fd->toChars());
|
||||
gIR->funcGenStates.emplace_back(new FuncGenState(*irFunc, *gIR));
|
||||
auto &funcGen = gIR->funcGen();
|
||||
SCOPE_EXIT {
|
||||
assert(&gIR->funcGen() == &funcGen);
|
||||
gIR->funcGenStates.pop_back();
|
||||
};
|
||||
|
||||
const auto f = static_cast<TypeFunction *>(fd->type->toBasetype());
|
||||
IrFuncTy &irFty = irFunc->irFty;
|
||||
|
@ -1116,9 +1121,6 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
|
|||
}
|
||||
|
||||
gIR->scopes.pop_back();
|
||||
|
||||
assert(&gIR->funcGen() == &funcGen);
|
||||
gIR->funcGenStates.pop_back();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue