[clang] [analyzer] Support C++23 static operator calls (PR #84972)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 01:00:22 PDT 2024


================
@@ -709,6 +710,77 @@ class CXXInstanceCall : public AnyFunctionCall {
   }
 };
 
+/// Represents a static C++ operator call.
+///
+/// "A" in this example.
+/// However, "B" and "C" are represented by SimpleFunctionCall.
+/// \code
+///   struct S {
+///     int pad;
+///     static void operator()(int x, int y);
+///   };
+///   S s{10};
+///   void (*fptr)(int, int) = &S::operator();
+///
+///   s(1, 2);  // A
+///   S::operator()(1, 2);  // B
+///   fptr(1, 2); // C
+/// \endcode
+class CXXStaticOperatorCall : public SimpleFunctionCall {
+  friend class CallEventManager;
+
+protected:
+  CXXStaticOperatorCall(const CallExpr *CE, ProgramStateRef St,
----------------
tomasz-kaminski-sonarsource wrote:

To guaranteee that cast in `getOriginExpr` is correct.
```suggestion
  CXXStaticOperatorCall(const CXXOperatorCallExpr *CE, ProgramStateRef St,
```

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


More information about the cfe-commits mailing list