66 for (
Pointer *
P = DeadBlocks->B.Pointers;
P;
P =
P->asBlockPointer().Next)
67 DeadBlocks->B.removePointer(
P);
69 std::free(DeadBlocks);
102 reinterpret_cast<char *
>(std::malloc(
sizeof(
DeadBlock) + Size));
103 auto *D =
new (Memory)
DeadBlock(DeadBlocks, B);
106 std::memcpy(D->rawData(), B->
rawData(), Size);
107 D->B.IsInitialized =
false;
115 bool NoAllocationsLeft = !Alloc->hasAllocations();
118 for (
const auto &[Source, Site] : Alloc->allocation_sites()) {
119 assert(!Site.empty());
121 CCEDiag(Source->getExprLoc(), diag::note_constexpr_memory_leak)
122 << (Site.size() - 1) << Source->getSourceRange();
127 return NoAllocationsLeft || !
getLangOpts().CPlusPlus20;
135 const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
Func->getDecl());
139 if (!FnII || !FnII->
isStr(Name))
143 dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
149 if (CTSD->isInStdNamespace() && ClassII && ClassII->
isStr(
"allocator") &&
151 QualType ElemType = TAL[0].getAsType();
152 const auto *NewCall =
cast<CallExpr>(F->Caller->getExpr(F->getRetPC()));
153 return {NewCall, ElemType};
168 FFDiag(
Current->getSource(OpPC), diag::note_constexpr_step_limit_exceeded);
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.
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.
Base class for stack frames, shared between VM and walker.
Frame storing local variables.
Stack frame storing temporaries and parameters.
InterpFrame BottomFrame
Bottom function frame.
Context & Ctx
Interpreter Context.
bool noteStep(CodePtr OpPC)
Note that a step has been executed.
const unsigned EvalID
ID identifying this evaluation.
InterpState(const State &Parent, Program &P, InterpStack &Stk, Context &Ctx, SourceMapper *M=nullptr)
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.
Expr::EvalStatus & getEvalStatus() const
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.
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.
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
U cast(CodeGen::Address addr)