[PATCH] D44281: [analyzer] Suppress more MallocChecker positives in reference counting pointer destructors.

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 9 11:26:24 PST 2018


george.karpenkov added a comment.

> we often run out of inlining stack depth limit

Can we consider increasing that limit? I'd much rather have a limit on maximum path *length* (which we currently don't have), as longer paths are more likely to be false positives.
On the other hand, I don't see that many issues with paths which perform too many inlinings.



================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2835
+    // FIXME: Use regular expressions when they get marked as acceptable
+    // in the LLVM coding standard?
+    if (N.contains_lower("ptr") || N.contains_lower("pointer")) {
----------------
There's `lib/Support/Regex.cpp`?


================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2904
       for (const LocationContext *LC = CurrentLC; LC; LC = LC->getParent()) {
-        if (isa<CXXDestructorDecl>(LC->getDecl())) {
-          assert(!ReleaseDestructorLC &&
-                 "There can be only one release point!");
-          ReleaseDestructorLC = LC->getCurrentStackFrame();
-          // It is unlikely that releasing memory is delegated to a destructor
-          // inside a destructor of a shared pointer, because it's fairly hard
-          // to pass the information that the pointer indeed needs to be
-          // released into it. So we're only interested in the innermost
-          // destructor.
-          break;
+        if (const CXXDestructorDecl *DD =
+                dyn_cast<CXXDestructorDecl>(LC->getDecl())) {
----------------
auto


Repository:
  rC Clang

https://reviews.llvm.org/D44281





More information about the cfe-commits mailing list