Go to the documentation of this file.
15 using namespace clang;
21 unsigned ExtraNotes) {
22 return diag(Loc, DiagId, ExtraNotes,
false);
26 unsigned ExtraNotes) {
28 return diag(E->
getExprLoc(), DiagId, ExtraNotes,
false);
34 unsigned ExtraNotes) {
36 return diag(SI.
getLoc(), DiagId, ExtraNotes,
false);
42 unsigned ExtraNotes) {
49 return diag(Loc, DiagId, ExtraNotes,
true);
53 unsigned ExtraNotes) {
58 unsigned ExtraNotes) {
87 unsigned ExtraNotes,
bool IsCCEDiag) {
89 if (EvalStatus.
Diag) {
97 CallStackNotes =
std::min(CallStackNotes, Limit + 1);
103 EvalStatus.
Diag->clear();
104 EvalStatus.
Diag->reserve(1 + ExtraNotes + CallStackNotes);
105 addDiag(Loc, DiagId);
117 void State::addCallStack(
unsigned Limit) {
120 unsigned SkipStart = ActiveCalls, SkipEnd = SkipStart;
121 if (Limit && Limit < ActiveCalls) {
122 SkipStart = Limit / 2 + Limit % 2;
123 SkipEnd = ActiveCalls - Limit / 2;
127 unsigned CallIdx = 0;
130 for (
Frame *F = Top; F != Bottom; F = F->
getCaller(), ++CallIdx) {
134 if (CallIdx >= SkipStart && CallIdx < SkipEnd) {
135 if (CallIdx == SkipStart) {
137 addDiag(CallLocation, diag::note_constexpr_calls_suppressed)
145 if (
auto *CD = dyn_cast_or_null<CXXConstructorDecl>(F->getCallee())) {
146 if (CD->isInheritingConstructor()) {
147 addDiag(CallLocation, diag::note_constexpr_inherited_ctor_call_here)
154 llvm::raw_svector_ostream Out(Buffer);
156 addDiag(CallLocation, diag::note_constexpr_call_here) << Out.str();
void addNotes(ArrayRef< PartialDiagnosticAt > Diags)
Add a stack of notes to a prior diagnostic.
A little helper class used to produce diagnostics.
virtual Frame * getCurrentFrame()=0
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Encodes a location in the source.
virtual Frame * getCaller() const =0
Returns a pointer to the caller frame.
SourceLocation getLoc() const
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
virtual const Frame * getBottomFrame() const =0
EvalStatus is a struct with detailed info about an evaluation in progress.
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
virtual bool checkingPotentialConstantExpression() const =0
__DEVICE__ int min(int __a, int __b)
virtual ASTContext & getCtx() const =0
OptionalDiagnostic FFDiag(SourceLocation Loc, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0)
unsigned getConstexprBacktraceLimit() const
Retrieve the maximum number of constexpr evaluation notes to emit along with a given diagnostic.
Describes the statement/declaration an opcode was generated from.
A partial diagnostic which we might know in advance that we are not going to emit.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
virtual bool hasPriorDiagnostic()=0
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
virtual unsigned getCallStackDepth()=0
virtual bool hasActiveDiagnostic()=0
Base class for stack frames, shared between VM and walker.
virtual void setActiveDiagnostic(bool Flag)=0
OptionalDiagnostic Note(SourceLocation Loc, diag::kind DiagId)
Add a note to a prior diagnostic.
virtual void setFoldFailureDiagnostic(bool Flag)=0
virtual Expr::EvalStatus & getEvalStatus() const =0
DiagnosticBuilder report(SourceLocation Loc, diag::kind DiagId)
Directly reports a diagnostic message.
This represents one expression.
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.