[llvm] [CaptureTracking][NFC] Clarify usage expectations in PointerMayBeCaptured comments (PR #132744)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 05:24:14 PDT 2025


================
@@ -41,13 +41,17 @@ namespace llvm {
   /// MaxUsesToExplore specifies how many uses the analysis should explore for
   /// one value before giving up due too "too many uses". If MaxUsesToExplore
   /// is zero, a default value is assumed.
+  /// This assumes the pointer is to a function-local object. The caller is
+  /// responsible for ensuring this.
----------------
nikic wrote:

This depends on the use case. In most cases you'd want to pass a function-local object, but e.g. to infer captures() attribute you'd just work with arbitrary function arguments.

I think I'd add something like this instead:

> This function only considers captures of the passed value via its use-def chain, without considering captures of values it may be based on, or implicit captures such as for external globals.



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


More information about the llvm-commits mailing list