[PATCH] D54823: [analyzer][MallocChecker][NFC] Document and reorganize some functions
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 21 18:10:36 PST 2018
Szelethus added a comment.
I also have some very neat ideas how the split up should go, but I'd like to mature the idea in my head for just a bit longer.
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:24-27
+// It also has a boolean "Optimistic" checker option, which if set to true
+// will cause the checker to model user defined memory management related
+// functions annotated via the attribute ownership_takes, ownership_holds
+// and ownership_returns.
----------------
Source: https://reviews.llvm.org/D7905
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:242-245
+/// This is important because realloc may fail, and that needs special modeling.
+/// Whether reallocation failed or not will not be known until later, so we'll
+/// store whether upon failure 'fromPtr' will be freed, or needs to be freed
+/// later, etc.
----------------
Source: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060216.html
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:435-443
+ /// User-defined function may have the ownership_returns attribute, which
+ /// annotates that the function returns with an object that was allocated on
+ /// the heap, and passes the ownertship to the callee.
+ ///
+ /// void __attribute((ownership_returns(malloc, 1))) *my_malloc(size_t);
+ ///
+ /// It has two parameters:
----------------
Source:
http://lists.llvm.org/pipermail/cfe-dev/2010-June/009600.html
https://github.com/llvm-mirror/clang/commit/dd0e490c24aeade2c59ca4cae171199f6af9f02e
================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1359-1363
+ /// Non-trivial constructors have a chance to escape 'this', but marking all
+ /// invocations of trivial constructors as escaped would cause too great of
+ /// reduction of true positives, so let's just do that for constructor that
+ /// have an argument of a pointer-to-record type.
+ if (!PM.isConsumedExpr(NE) && hasNonTrivialConstructorCall(NE))
----------------
Source:
https://bugs.llvm.org/show_bug.cgi?id=19102
https://reviews.llvm.org/D4025
Repository:
rC Clang
https://reviews.llvm.org/D54823
More information about the cfe-commits
mailing list