[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 23:05:06 PDT 2024


================
@@ -4756,18 +4758,22 @@ class FunctionEffect {
   /// The description printed in diagnostics, e.g. 'nonblocking'.
   StringRef name() const;
 
-  /// Return true if the effect is allowed to be inferred on the callee,
-  /// which is either a FunctionDecl or BlockDecl.
+  /// Determine whether the effect is allowed to be inferred on the callee,
+  /// which is either a FunctionDecl or BlockDecl. If the returned optional
+  /// is empty, inference is permitted; otherwise it holds the effect which
+  /// blocked inference.
   /// Example: This allows nonblocking(false) to prevent inference for the
   /// function.
-  bool canInferOnFunction(const Decl &Callee) const;
+  std::optional<FunctionEffect>
+  effectProhibitingInference(const Decl &Callee,
+                             const FunctionEffectKindSet &CalleeFX) const;
----------------
Sirraide wrote:

`FunctionEffectKindSet` is so small that we probably want to pass it by value.

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


More information about the cfe-commits mailing list