[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 20 07:08:42 PDT 2021


xazax.hun added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:291
   // we can try this function
-  if (Call.getNumArgs() == 2 &&
-      Call.getDecl()->getDeclContext()->isStdNamespace())
-    if (smartptr::isStdSmartPtr(Call.getArgExpr(0)) ||
-        smartptr::isStdSmartPtr(Call.getArgExpr(1)))
-      if (handleComparisionOp(Call, C))
-        return true;
-
-  if (isStdOstreamOperatorCall(Call))
+  if (ModelSmartPtrDereference && isPotentiallyComparisionOpCall(Call))
+    if (handleComparisionOp(Call, C))
----------------
RedDocMD wrote:
> xazax.hun wrote:
> > I'd prefer not repeating the `ModelSmartPtrDereference` check.
> I don't think we can do that, since the `isBoolConversion()` check has a branch which is executed when `ModelSmartPtrDereference` is false.
That function is way below. I was just thinking about merging the first two check. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106296/new/

https://reviews.llvm.org/D106296



More information about the cfe-commits mailing list