Skip to content

Commit e7b827e

Browse files
committed
Add a FIXME comment; NFC
The constant expression engines use a list of note diagnostics to report back whether an evaluation is a valid constant expression or not. This requires the engines to generate those note diagnostics, and that can be expensive in cases where we're converting an APValue to a string as a streamed argument to the note. If we're going to display the note, then that expense is warranted. However, there are operations looking for a yes/no answer to whether something is a constant expression and won't display the diagnostics at all. Those uses are paying an expense they shouldn't have to.
1 parent 98191d7 commit e7b827e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ class Expr : public ValueStmt {
607607
/// foldable. If the expression is foldable, but not a constant expression,
608608
/// the notes will describes why it isn't a constant expression. If the
609609
/// expression *is* a constant expression, no notes will be produced.
610+
///
611+
/// FIXME: this causes significant performance concerns and should be
612+
/// refactored at some point. Not all evaluations of the constant
613+
/// expression interpreter will display the given diagnostics, this means
614+
/// those kinds of uses are paying the expense of generating a diagnostic
615+
/// (which may include expensive operations like converting APValue objects
616+
/// to a string representation).
610617
SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr;
611618

612619
EvalStatus() = default;

0 commit comments

Comments
 (0)