[PATCH] D151094: [clang][wip] Implement P2564 "consteval must propagate up"
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 22 07:12:59 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/AST/DeclBase.h:1695
/// Number of non-inherited bits in FunctionDeclBitfields.
enum { NumFunctionDeclBits = 29 };
----------------
Need to update this as well.
================
Comment at: clang/include/clang/Sema/ScopeInfo.h:239
+ /// Whether we found an immediate-escalating expression
+ Expr *ImmediateEscalatingExpression = nullptr;
----------------
================
Comment at: clang/lib/AST/Decl.cpp:3180
+ // consteval specifier,
+ if (isDefaulted() && !isConsteval())
+ return true;
----------------
Should this be looking at `isExplicitlyDefaulted()` instead?
================
Comment at: clang/lib/AST/Decl.cpp:3184
+ // defined with the constexpr specifier.
+ auto TK = getTemplatedKind();
+ if ((TK != TK_NonTemplate && TK != TK_DependentNonTemplate) &&
----------------
Spell out the type.
================
Comment at: clang/lib/AST/Decl.cpp:3185
+ auto TK = getTemplatedKind();
+ if ((TK != TK_NonTemplate && TK != TK_DependentNonTemplate) &&
+ isConstexprSpecified())
----------------
================
Comment at: clang/lib/AST/Decl.cpp:3199
+ // immediate-escalating expression
+ if (auto *MD = dyn_cast<CXXMethodDecl>(this);
+ MD && MD->isLambdaStaticInvoker())
----------------
This code doesn't seem to match the comment (it matches the code below though).
================
Comment at: clang/lib/AST/Decl.cpp:3203-3205
+ if (isImmediateEscalating() && BodyContainsImmediateEscalatingExpressions())
+ return true;
+ return false;
----------------
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:2453
+ Diag(FD->getLocation(), diag::note_defined_here) << FD;
+ if (auto *CE = llvm::dyn_cast<CallExpr>(
+ ImmediateEscalatingExpression->IgnoreImplicit())) {
----------------
================
Comment at: clang/lib/Sema/SemaExpr.cpp:17983
+ if (!E.get()->isValueDependent() &&
+ !E.get()->isCXX11ConstantExpr(getASTContext()) &&
+ ExprEvalContexts.back().InImmediateEscalatingFunctionContext &&
----------------
Ouch, this is pretty expensive because it actually evaluates the constant expression (and promptly forgets what it evaluated).
================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:5027-5029
+ if (CallOp->isInvalidDecl())
+ return true;
+ return false;
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151094/new/
https://reviews.llvm.org/D151094
More information about the cfe-commits
mailing list