[PATCH] D151094: [clang] Implement P2564 "consteval must propagate up"

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 11:36:29 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:17980-17987
+  if (auto *Call = dyn_cast<CallExpr>(E->IgnoreImplicit());
+      Call && Call->getCallee()) {
+    if (auto *DeclRef =
+            dyn_cast<DeclRefExpr>(Call->getCallee()->IgnoreImplicit()))
+      DeclRef->setIsImmediateEscalating(true);
+  } else if (auto *DeclRef = dyn_cast<DeclRefExpr>(E->IgnoreImplicit())) {
+    DeclRef->setIsImmediateEscalating(true);
----------------
aaron.ballman wrote:
> Should we be asserting the given expression is either a `CallExpr` (with a valid callee) or a `DeclRefExpr`? Otherwise, if called with something else, we'll claim the function found an immediately escalating expression but we won't know *what* caused that.
We should. Doing that, I realized the case of CXXConstructExpr was not handled so now both DeclRef and CXXConstructExpr track whether they are immediate escalating (which is only useful for diagnostics but it's a pretty useful diagnostic)


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