9#ifndef LLVM_CLANG_AST_INTERP_INTERPHELPERS_H
10#define LLVM_CLANG_AST_INTERP_INTERPHELPERS_H
33 ArrayRef<int64_t> ArrayIndices, int64_t &
Result);
75 S.
CCEDiag(E, diag::note_constexpr_overflow) << SrcValue << E->
getType();
80 uint64_t Limit = S.
getLangOpts().ConstexprStepLimit;
81 if (Limit != 0 && NumElems > Limit) {
83 diag::note_constexpr_new_exceeds_limits)
92 if (RM == llvm::RoundingMode::Dynamic)
93 return llvm::RoundingMode::NearestTiesToEven;
99 S.
FFDiag(Loc, diag::note_invalid_subexpr_in_const_expr)
104template <
typename SizeT>
106 unsigned ElemSize,
bool IsNoThrow) {
112 if ((NumElements->bitWidth() - NumElements->isSigned()) <
121 assert(MaxElements.isPositive());
122 if (NumElements->toAPSInt().getActiveBits() >
124 *NumElements > MaxElements) {
128 if (NumElements->isSigned() && NumElements->isNegative()) {
129 S.
FFDiag(Loc, diag::note_constexpr_new_negative)
132 S.
FFDiag(Loc, diag::note_constexpr_new_too_large)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
This represents one expression.
RoundingMode getRoundingMode() const
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Encodes a location in the source.
A memory block, either on the stack or in the heap.
Pointer into the code segment.
const Expr * getExpr(CodePtr PC) const
SourceInfo getSource(CodePtr PC) const
Map a location to a source.
SourceLocation getLocation(CodePtr PC) const
SourceRange getRange(CodePtr PC) const
InterpFrame * Current
The current frame.
A pointer to a memory block, live or dead.
Describes the statement/declaration an opcode was generated from.
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)
ASTContext & getASTContext() const
bool noteUndefinedBehavior() const
Note that we hit something that was technically undefined behavior, but that we can evaluate past it ...
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 CheckNewDeleteForms(InterpState &S, CodePtr OpPC, DynamicAllocator::Form AllocForm, DynamicAllocator::Form DeleteForm, const Descriptor *D, const Expr *NewExpr)
Diagnose mismatched new[]/delete or new/delete[] pairs.
static llvm::RoundingMode getRoundingMode(FPOptions FPO)
bool Call(InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
bool CheckMutable(InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a pointer points to a mutable field.
bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a value can be loaded from a block.
bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E, ArrayRef< int64_t > ArrayIndices, int64_t &IntResult)
Interpret an offsetof operation.
bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a pointer is in range.
bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a pointer is live and accessible.
static bool handleOverflow(InterpState &S, CodePtr OpPC, const T &SrcValue)
bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call, uint32_t BuiltinID)
Interpret a builtin function.
bool CheckDummy(InterpState &S, CodePtr OpPC, const Block *B, AccessKinds AK)
Checks if a pointer is a dummy pointer.
bool CheckArray(InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if the array is offsetable.
bool CheckArraySize(InterpState &S, CodePtr OpPC, uint64_t NumElems)
bool DoMemcpy(InterpState &S, CodePtr OpPC, const Pointer &Src, Pointer &Dest)
Copy the contents of Src into Dest.
UnsignedOrNone evaluateBuiltinObjectSize(const ASTContext &ASTCtx, unsigned Kind, Pointer &Ptr)
bool Interpret(InterpState &S)
Interpreter entry point.
The JSON file list parser is used to communicate input to InstallAPI.
CheckSubobjectKind
The order of this enum is important for diagnostics.
@ Result
The result type of a method or function.
AccessKinds
Kinds of access we can perform on an object, for diagnostics.
Describes a memory block created by an allocation site.
static constexpr unsigned MaxArrayElemBytes
Maximum number of bytes to be used for array elements.