22 unsigned ExtraNotes) {
23 return diag(
Loc, DiagId, ExtraNotes,
false);
27 unsigned ExtraNotes) {
28 if (getEvalStatus().
Diag)
29 return diag(
E->
getExprLoc(), DiagId, ExtraNotes,
false);
30 setActiveDiagnostic(
false);
35 unsigned ExtraNotes) {
36 if (getEvalStatus().
Diag)
37 return diag(SI.
getLoc(), DiagId, ExtraNotes,
false);
38 setActiveDiagnostic(
false);
43 unsigned ExtraNotes) {
46 if (!getEvalStatus().
Diag || !getEvalStatus().
Diag->empty()) {
47 setActiveDiagnostic(
false);
50 return diag(
Loc, DiagId, ExtraNotes,
true);
54 unsigned ExtraNotes) {
55 return CCEDiag(
E->
getExprLoc(), DiagId, ExtraNotes);
59 unsigned ExtraNotes) {
60 return CCEDiag(SI.
getLoc(), DiagId, ExtraNotes);
64 if (!hasActiveDiagnostic())
70 if (hasActiveDiagnostic()) {
71 getEvalStatus().Diag->insert(getEvalStatus().
Diag->end(), Diags.begin(),
77 return getCtx().getDiagnostics().Report(
Loc, DiagId);
83 getEvalStatus().Diag->push_back(std::make_pair(
Loc, PD));
84 return getEvalStatus().Diag->back().second;
88 unsigned ExtraNotes,
bool IsCCEDiag) {
90 if (EvalStatus.
Diag) {
91 if (hasPriorDiagnostic()) {
95 unsigned CallStackNotes = getCallStackDepth() - 1;
96 unsigned Limit = getCtx().getDiagnostics().getConstexprBacktraceLimit();
98 CallStackNotes = std::min(CallStackNotes, Limit + 1);
99 if (checkingPotentialConstantExpression())
102 setActiveDiagnostic(
true);
103 setFoldFailureDiagnostic(!IsCCEDiag);
104 EvalStatus.
Diag->clear();
105 EvalStatus.
Diag->reserve(1 + ExtraNotes + CallStackNotes);
106 addDiag(
Loc, DiagId);
107 if (!checkingPotentialConstantExpression()) {
112 setActiveDiagnostic(
false);
116const LangOptions &State::getLangOpts()
const {
return getCtx().getLangOpts(); }
118void State::addCallStack(
unsigned Limit) {
120 unsigned ActiveCalls = getCallStackDepth() - 1;
121 unsigned SkipStart = ActiveCalls, SkipEnd = SkipStart;
122 if (Limit && Limit < ActiveCalls) {
123 SkipStart = Limit / 2 + Limit % 2;
124 SkipEnd = ActiveCalls - Limit / 2;
128 unsigned CallIdx = 0;
129 const Frame *Top = getCurrentFrame();
130 const Frame *Bottom = getBottomFrame();
131 for (
const Frame *F = Top; F != Bottom; F = F->
getCaller(), ++CallIdx) {
135 if (CallIdx >= SkipStart && CallIdx < SkipEnd) {
136 if (CallIdx == SkipStart) {
138 addDiag(CallRange.
getBegin(), diag::note_constexpr_calls_suppressed)
147 dyn_cast_if_present<CXXConstructorDecl>(F->getCallee());
148 CD && CD->isInheritingConstructor()) {
150 diag::note_constexpr_inherited_ctor_call_here)
156 llvm::raw_svector_ostream Out(Buffer);
159 addDiag(CallRange.
getBegin(), diag::note_constexpr_call_here)
160 << Out.str() << CallRange;
Defines the clang::ASTContext interface.
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.
Implements a partial diagnostic which may not be emitted.
A little helper class used to produce diagnostics.
This represents one expression.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A partial diagnostic which we might know in advance that we are not going to emit.
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
Base class for stack frames, shared between VM and walker.
virtual Frame * getCaller() const =0
Returns a pointer to the caller frame.
Describes the statement/declaration an opcode was generated from.
SourceLocation getLoc() const
The JSON file list parser is used to communicate input to InstallAPI.
EvalStatus is a struct with detailed info about an evaluation in progress.
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...