[clang] [LifetimeSafety] Fix compiler crash with `static operator()` (PR #187853)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 03:23:04 PDT 2026


================
@@ -655,6 +656,13 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
   // All arguments to a function are a use of the corresponding expressions.
   for (const Expr *Arg : Args)
     handleUse(Arg);
+
+  if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(Call);
+      OCE && OCE->getOperator() == OO_Call && FD->isStatic()) {
+    // Ignore first element
+    Args = Args.slice(1);
+  }
+
----------------
usx95 wrote:

Can you try doing this in `FactsGenerator::VisitCXXOperatorCallExpr` instead ?

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


More information about the cfe-commits mailing list