22 :
Parent(
Parent), M(M),
P(
P), Stk(Stk), Ctx(Ctx), BottomFrame(*this),
23 Current(&BottomFrame) {}
29 Current(&BottomFrame) {}
51 for (
Pointer *
P = DeadBlocks->B.Pointers;
P;
P =
P->asBlockPointer().Next)
52 DeadBlocks->B.removePointer(
P);
54 std::free(DeadBlocks);
93 reinterpret_cast<char *
>(std::malloc(
sizeof(
DeadBlock) + Size));
94 auto *
D =
new (Memory)
DeadBlock(DeadBlocks, B);
97 std::memcpy(
D->rawData(), B->
rawData(), Size);
98 D->B.IsInitialized =
false;
106 bool NoAllocationsLeft = !Alloc->hasAllocations();
109 for (
const auto &[Source, Site] : Alloc->allocation_sites()) {
110 assert(!Site.empty());
112 CCEDiag(Source->getExprLoc(), diag::note_constexpr_memory_leak)
113 << (Site.size() - 1) << Source->getSourceRange();
118 return NoAllocationsLeft || !
getLangOpts().CPlusPlus20;
126 const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
Func->getDecl());
130 if (!FnII || !FnII->
isStr(Name))
134 dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
140 if (CTSD->isInStdNamespace() && ClassII && ClassII->
isStr(
"allocator") &&
142 QualType ElemType = TAL[0].getAsType();
143 const auto *NewCall = cast<CallExpr>(F->Caller->getExpr(F->getRetPC()));
144 return {NewCall, ElemType};
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
This represents one expression.
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.
The base class of the type hierarchy.
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.
InterpFrame * Caller
The frame of the previous function.
bool isBottomFrame() const
Stack frame storing temporaries and parameters.
InterpFrame BottomFrame
Bottom function frame.
bool reportOverflow(const Expr *E, const llvm::APSInt &Value)
Reports overflow and return true if evaluation should continue.
bool noteUndefinedBehavior() override
Frame * getCurrentFrame() override
bool maybeDiagnoseDanglingAllocations()
Diagnose any dynamic allocations that haven't been freed yet.
InterpFrame * Current
The current frame.
InterpState(State &Parent, Program &P, InterpStack &Stk, Context &Ctx, SourceMapper *M=nullptr)
std::optional< bool > ConstantContextOverride
void deallocate(Block *B)
Deallocates a pointer.
bool checkingPotentialConstantExpression() const override
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.
Interface for the VM to interact with the AST walker's context.
const LangOptions & getLangOpts() 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.
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.