[clang] e7b827e - Add a FIXME comment; NFC
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 09:16:43 PDT 2023
Author: Aaron Ballman
Date: 2023-10-18T12:16:33-04:00
New Revision: e7b827e11bd36cb7056538d05761039af9ced60d
URL: https://github.com/llvm/llvm-project/commit/e7b827e11bd36cb7056538d05761039af9ced60d
DIFF: https://github.com/llvm/llvm-project/commit/e7b827e11bd36cb7056538d05761039af9ced60d.diff
LOG: 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.
Added:
Modified:
clang/include/clang/AST/Expr.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index b69c616b0090365..638f886edd095f1 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -607,6 +607,13 @@ class Expr : public ValueStmt {
/// foldable. If the expression is foldable, but not a constant expression,
/// the notes will describes why it isn't a constant expression. If the
/// expression *is* a constant expression, no notes will be produced.
+ ///
+ /// FIXME: this causes significant performance concerns and should be
+ /// refactored at some point. Not all evaluations of the constant
+ /// expression interpreter will display the given diagnostics, this means
+ /// those kinds of uses are paying the expense of generating a diagnostic
+ /// (which may include expensive operations like converting APValue objects
+ /// to a string representation).
SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr;
EvalStatus() = default;
More information about the cfe-commits
mailing list