[clang] [clang][dataflow] Add captured parameters to ReferencedDecls for lamb… (PR #117771)

Samira Bazuzi via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 15:25:54 PST 2024


================
@@ -146,6 +146,10 @@ struct ReferencedDecls {
   /// Free functions and member functions which are referenced (but not
   /// necessarily called).
   llvm::DenseSet<const FunctionDecl *> Functions;
+  /// Parameters of other functions, captured by reference by a lambda. This is
+  /// empty except when ReferencedDecls are computed for a lambda's call
+  /// operator.
+  llvm::DenseSet<const ParmVarDecl *> LambdaCapturedParams;
----------------
bazuzi wrote:

Other captured locals are already included by the existing traversal. We also see the parameters in the insertIfLocal case, but currently exclude parameters in order to exclude the current function's parameters. If we wanted to change that restriction to not exclude captured parameters, we'd have to check each one to see if it is a capture or a parameter of the current function, each time they are seen in the function. This is the alternative I allude to in the commit description.

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


More information about the cfe-commits mailing list