[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 08:00:46 PST 2024


================
@@ -985,6 +986,9 @@ class Analyzer {
       if (auto *Dtor = dyn_cast<CXXDestructorDecl>(CurrentCaller.CDecl))
         followDestructor(dyn_cast<CXXRecordDecl>(Dtor->getParent()), Dtor);
 
+      if (auto *FD = dyn_cast<FunctionDecl>(CurrentCaller.CDecl))
+        TrailingRequiresClause = FD->getTrailingRequiresClause();
----------------
dougsonos wrote:

That's a good question. This is sufficient/correct for a couple of reasons:

- This whole `RecursiveASTVisitor` subclass is called for one function/lambda/block at a time, and this (new) member `TrailingRequiresClause` is being set for that "top-level" function only.
- Lambdas and blocks have overridden `Traverse` methods in order to skip their bodies -- which also mean we don't care about, and don't visit, their `requires` clauses.

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


More information about the cfe-commits mailing list