71 assert(
Current->isBottomFrame());
78 for (
Pointer *
P = DeadBlocks->B.Pointers;
P;
P =
P->asBlockPointer().Next)
79 DeadBlocks->B.removePointer(
P);
81 std::free(DeadBlocks);
106 if (B->IsInitialized)
114 reinterpret_cast<char *
>(std::malloc(
sizeof(
DeadBlock) + Size));
115 auto *D =
new (Memory)
DeadBlock(DeadBlocks, B);
118 std::memcpy(D->rawData(), B->
rawData(), Size);
119 D->B.IsInitialized =
false;
127 bool NoAllocationsLeft = !Alloc->hasAllocations();
130 for (
const auto &[Source, Site] : Alloc->allocation_sites()) {
131 assert(!Site.empty());
133 CCEDiag(Source->getExprLoc(), diag::note_constexpr_memory_leak)
134 << (Site.size() - 1) << Source->getSourceRange();
139 return NoAllocationsLeft || !
getLangOpts().CPlusPlus20;
147 const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
Func->getDecl());
151 if (!FnII || !FnII->
isStr(Name))
155 dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
161 if (CTSD->isInStdNamespace() && ClassII && ClassII->
isStr(
"allocator") &&
163 QualType ElemType = TAL[0].getAsType();
164 const auto *NewCall =
cast<CallExpr>(F->Caller->getExpr(F->getRetOpPC()));
165 return {NewCall, ElemType};
172bool InterpState::diagnoseStepLimitExceeded(
CodePtr OpPC) {
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
A (possibly-)qualified type.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
@ Type
The template argument is a type.
A memory block, either on the stack or in the heap.
unsigned getSize() const
Returns the size of the block, including metadata.
void invokeDtor()
Invokes the Destructor.
bool isStatic() const
Checks if the block has static storage duration.
std::byte * rawData()
Returns a pointer to the raw data, including metadata.
bool isInitialized() const
Returns whether the data of this block has been initialized via invoking the Ctor func.
bool hasPointers() const
Checks if the block has any live pointers.
Pointer into the code segment.
Holds all information required to evaluate constexpr code in a module.
Descriptor for a dead block.
Allocator for function frames.
Base class for stack frames, shared between VM and walker.
Frame storing local variables.
SourceInfo getSource(CodePtr PC) const
Map a location to a source.
Stack frame storing temporaries and parameters.
InterpFrame BottomFrame
Bottom function frame.
Context & Ctx
Interpreter Context.
InterpState(const EvalSettings &Settings, Program &P, InterpStack &Stk, FrameAllocator &FrameAlloc, Context &Ctx, SourceMapper *M=nullptr)
const unsigned EvalID
ID identifying this evaluation.
InterpStack & Stk
Temporary stack.
bool maybeDiagnoseDanglingAllocations()
Diagnose any dynamic allocations that haven't been freed yet.
unsigned StepsLeft
Steps left during evaluation.
InterpFrame * Current
The current frame.
const Frame * getCurrentFrame() override
std::optional< bool > ConstantContextOverride
const bool InfiniteSteps
Whether infinite evaluation steps have been requested.
void deallocate(Block *B)
Deallocates a pointer.
StdAllocatorCaller getStdAllocatorCaller(StringRef Name) const
bool inConstantContext() const
Program & P
Reference to the module containing all bytecode.
A pointer to a memory block, live or dead.
The program contains and links the bytecode for all functions.
Interface for classes which map locations to sources.
OptionalDiagnostic FFDiag(SourceLocation Loc, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0)
Diagnose that the evaluation could not be folded (FF => FoldFailure)
State(ASTContext &ASTCtx, Expr::EvalStatus &EvalStatus)
bool CheckingPotentialConstantExpression
Whether we're checking that an expression is a potential constant expression.
bool CheckingForUndefinedBehavior
Whether we're checking for an expression that has undefined behavior.
Expr::EvalStatus & EvalStatus
ASTContext & getASTContext() const
OptionalDiagnostic CCEDiag(SourceLocation Loc, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0)
Diagnose that the evaluation does not produce a C++11 core constant expression.
const LangOptions & getLangOpts() const
bool checkingPotentialConstantExpression() const
Are we checking whether the expression is a potential constant expression?
bool InConstantContext
Whether or not we're in a context where the front end requires a constant value.
Top level wrappers for InstallAPI frontend operations.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ ConstantExpression
Evaluate as a constant expression.
U cast(CodeGen::Address addr)
EvalStatus is a struct with detailed info about an evaluation in progress.
bool CheckingForUndefinedBehavior
const EvaluationMode EvalMode
bool CheckingPotentialConstantExpression