Author: Timm Bäder Date: 2023-01-18T18:14:23+01:00 New Revision: 29d25f9e9a4c075023ac7d8f19e7073e9b2a0359
URL: https://github.com/llvm/llvm-project/commit/29d25f9e9a4c075023ac7d8f19e7073e9b2a0359 DIFF: https://github.com/llvm/llvm-project/commit/29d25f9e9a4c075023ac7d8f19e7073e9b2a0359.diff LOG: [clang][Interp][NFC] Simplify InterpFrame constructor Try to decrease the block depth here a bit. Added: Modified: clang/lib/AST/Interp/InterpFrame.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp index 9acfbe3700e98..da228d011f874 100644 --- a/clang/lib/AST/Interp/InterpFrame.cpp +++ b/clang/lib/AST/Interp/InterpFrame.cpp @@ -24,19 +24,22 @@ InterpFrame::InterpFrame(InterpState &S, const Function *Func, : Caller(Caller), S(S), Func(Func), RetPC(RetPC), ArgSize(Func ? Func->getArgSize() : 0), Args(static_cast<char *>(S.Stk.top())), FrameOffset(S.Stk.size()) { - if (Func) { - if (unsigned FrameSize = Func->getFrameSize()) { - Locals = std::make_unique<char[]>(FrameSize); - for (auto &Scope : Func->scopes()) { - for (auto &Local : Scope.locals()) { - Block *B = new (localBlock(Local.Offset)) Block(Local.Desc); - B->invokeCtor(); - InlineDescriptor *ID = localInlineDesc(Local.Offset); - ID->Desc = Local.Desc; - ID->IsActive = true; - ID->Offset = sizeof(InlineDescriptor); - } - } + if (!Func) + return; + + unsigned FrameSize = Func->getFrameSize(); + if (FrameSize == 0) + return; + + Locals = std::make_unique<char[]>(FrameSize); + for (auto &Scope : Func->scopes()) { + for (auto &Local : Scope.locals()) { + Block *B = new (localBlock(Local.Offset)) Block(Local.Desc); + B->invokeCtor(); + InlineDescriptor *ID = localInlineDesc(Local.Offset); + ID->Desc = Local.Desc; + ID->IsActive = true; + ID->Offset = sizeof(InlineDescriptor); } } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits