26 Parent.CheckingPotentialConstantExpression;
38 Parent.CheckingPotentialConstantExpression;
63 for (
Pointer *
P = DeadBlocks->B.Pointers;
P;
P =
P->asBlockPointer().Next)
64 DeadBlocks->B.removePointer(
P);
66 std::free(DeadBlocks);
99 reinterpret_cast<char *
>(std::malloc(
sizeof(
DeadBlock) + Size));
100 auto *D =
new (Memory)
DeadBlock(DeadBlocks, B);
103 std::memcpy(D->rawData(), B->
rawData(), Size);
104 D->B.IsInitialized =
false;
112 bool NoAllocationsLeft = !Alloc->hasAllocations();
115 for (
const auto &[Source, Site] : Alloc->allocation_sites()) {
116 assert(!Site.empty());
118 CCEDiag(Source->getExprLoc(), diag::note_constexpr_memory_leak)
119 << (Site.size() - 1) << Source->getSourceRange();
124 return NoAllocationsLeft || !
getLangOpts().CPlusPlus20;
132 const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
Func->getDecl());
136 if (!FnII || !FnII->
isStr(Name))
140 dyn_cast<ClassTemplateSpecializationDecl>(MD->getParent());
146 if (CTSD->isInStdNamespace() && ClassII && ClassII->
isStr(
"allocator") &&
148 QualType ElemType = TAL[0].getAsType();
149 const auto *NewCall =
cast<CallExpr>(F->Caller->getExpr(F->getRetPC()));
150 return {NewCall, ElemType};
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.
Frame * getCurrentFrame() override
InterpStack & Stk
Temporary stack.
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.
const LangOptions & getLangOpts() const
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.
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.
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 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)