67 for (
Pointer *
P = DeadBlocks->B.Pointers;
P;
P =
P->asBlockPointer().Next)
68 DeadBlocks->B.removePointer(
P);
70 std::free(DeadBlocks);
103 reinterpret_cast<char *
>(std::malloc(
sizeof(
DeadBlock) + Size));
104 auto *D =
new (Memory)
DeadBlock(DeadBlocks, B);
107 std::memcpy(D->rawData(), B->
rawData(), Size);
108 D->B.IsInitialized =
false;
116 bool NoAllocationsLeft = !Alloc->hasAllocations();
119 for (
const auto &[Source, Site] : Alloc->allocation_sites()) {
120 assert(!Site.empty());
122 CCEDiag(Source->getExprLoc(), diag::note_constexpr_memory_leak)
123 << (Site.size() - 1) << Source->getSourceRange();
128 return NoAllocationsLeft || !
getLangOpts().CPlusPlus20;
136 const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
Func->getDecl());
140 if (!FnII || !FnII->
isStr(Name))
144 dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
150 if (CTSD->isInStdNamespace() && ClassII && ClassII->
isStr(
"allocator") &&
152 QualType ElemType = TAL[0].getAsType();
153 const auto *NewCall =
cast<CallExpr>(F->Caller->getExpr(F->getRetPC()));
154 return {NewCall, ElemType};
169 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)