9#ifndef LLVM_CLANG_AST_INTERP_INTERPHELPERS_H
10#define LLVM_CLANG_AST_INTERP_INTERPHELPERS_H
33 ArrayRef<int64_t> ArrayIndices, int64_t &
Result);
72 S.
CCEDiag(E, diag::note_constexpr_overflow) << SrcValue << E->
getType();
77 uint64_t Limit = S.
getLangOpts().ConstexprStepLimit;
78 if (Limit != 0 && NumElems > Limit) {
80 diag::note_constexpr_new_exceeds_limits)
89 if (RM == llvm::RoundingMode::Dynamic)
90 return llvm::RoundingMode::NearestTiesToEven;
96 S.
FFDiag(Loc, diag::note_invalid_subexpr_in_const_expr)
101template <
typename SizeT>
103 unsigned ElemSize,
bool IsNoThrow) {
109 if ((NumElements->bitWidth() - NumElements->isSigned()) <
118 assert(MaxElements.isPositive());
119 if (NumElements->toAPSInt().getActiveBits() >
121 *NumElements > MaxElements) {
125 if (NumElements->isSigned() && NumElements->isNegative()) {
126 S.
FFDiag(Loc, diag::note_constexpr_new_negative)
129 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
bool noteUndefinedBehavior() override
ASTContext & getASTContext() const override
InterpFrame * Current
The current frame.
const LangOptions & getLangOpts() const
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)
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 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.
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.
const FunctionProtoType * T
Describes a memory block created by an allocation site.
static constexpr unsigned MaxArrayElemBytes
Maximum number of bytes to be used for array elements.