[clang] [clang] visit constraint of NTTP (PR #91842)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Sat May 11 02:04:21 PDT 2024


================
@@ -2257,6 +2257,11 @@ void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
     const SubstNonTypeTemplateParmExpr *E) {
   // Profile exactly as the replacement expression.
   Visit(E->getReplacement());
+  if (auto *NTTP =
+          dyn_cast_if_present<NonTypeTemplateParmDecl>(E->getParameter());
----------------
zyn0217 wrote:

In `SubstNonTypeTemplateParmExpr::getParameter()` we returned a `NonTypeTemplateParmDecl` after a cast; so an `if_present` is unnecessary, at least `E->getParameter()` was presumed to return always non-null.

https://github.com/llvm/llvm-project/pull/91842


More information about the cfe-commits mailing list