Commit Graph

64 Commits

Author SHA1 Message Date
Nicholas Nethercote
a5c843fe5f Bug 1267550 (part 1) - Rename MOZ_MUST_USE as MOZ_MUST_USE_TYPE. r=ehsan.
This will allow MOZ_MUST_USE to be used for a different and more common case.

MozReview-Commit-ID: 4dQsdWjJfc6

--HG--
extra : rebase_source : 390ab56ef83d71eb6d28759a0195a79a78b153bd
2016-04-27 08:22:10 +10:00
Ehsan Akhgari
09ce2152c7 Bug 1264827 - Part 2: Add a static analysis to help check Rust wrapped C++ classes for members which are unsafe to memmove; r=mystor 2016-04-18 15:43:46 -04:00
Michael Layzell
c4c75e9287 Bug 1254247 - Ignore implicit Expr wrappers due to temporary cleanup in MUST_USE analysis, r=ehsan 2016-03-11 18:29:47 -05:00
Mike Hommey
cbb8f056e6 Bug 1255540 - Properly run the clang-plugin tests. r=gps 2016-03-11 12:22:24 +09:00
Andrea Marchesini
856342a4be Bug 1253187 - Remove some warnings in clang-plugin tests, r=ehsan 2016-03-03 18:31:12 +01:00
Michael Layzell
299ac653c2 Bug 1242789 - Allow lambdas to capture raw pointers to refcounted objects by reference, r=ehsan 2016-01-26 13:32:41 -05:00
Michael Layzell
2b12d59585 Bug 1226376 - Part 1: Allow non-trivial constexpr constructors in MOZ_TRIVIAL_CTOR_DTOR classes, r=ehsan 2016-01-08 15:34:24 -05:00
Jed Davis
f377ca14ea Bug 1201314 - Make most of std:: non-memmovable for static analysis purposes. r=mystor r=ehsan
For simplicity, the exceptions are hard-coded in the plugin: currently
std::pair and std::atomic.
2015-10-14 18:13:00 +02:00
Michael Layzell
24a4505d6d Bug 1214037 - Don't consider the result of an assignment expression MOZ_MUST_USE, r=ehsan 2015-10-14 16:06:36 -04:00
Michael Layzell
977f9a33ea Bug 1208814 - Part 1: Add an analysis to prevent default copy constructors from being called on refcounted objects, r=ehsan 2015-10-03 11:23:52 -04:00
Ehsan Akhgari
f8824f7e03 Bug 1182727 - Part 15: Build the clang-plugin C test in C11 mode; r=mystor
For some mysterious reason, the plugin crashes when loaded under
the -std=gnu89 that we use by default for C.
2015-10-02 11:09:23 -04:00
Michael Layzell
ee6e600d85 Bug 1201190 - Part 1: Add an analysis to prevent a type from being allocated in a temporary, r=ehsan 2015-09-12 16:53:31 -04:00
Michael Layzell
da3af84697 Bug 1156802 - Part 1: Add an analysis which prohibits explicit move constructors, r=ehsan 2015-09-12 12:34:44 -04:00
Jed Davis
3a2bfc48d5 Bug 1201309 - Make MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS work with MOZ_NON_MEMMOVABLE. r=ehsan f=mystor
This patch migrates moz_non_memmovable into the CustomTypeAnnotation
framework; bonus side-effects are more helpful error messages and less
code duplication.
2015-09-10 08:23:53 -07:00
Michael Layzell
5cb124397c Bug 1200413 - Part 1: Re-write RefCountedInsideLambdaChecker to use captures instead of checking for DeclRef instances, r=ehsan 2015-09-01 18:20:46 -04:00
Michael Layzell
40e60e8a8e Bug 1192130 - Part 1: Add MOZ_NON_AUTOABLE to restrict using auto in place of certain types, r=ehsan 2015-08-14 17:33:52 -04:00
Michael Layzell
535f5ff710 Bug 885515 - Part 1: Add an analysis for detecting non-heap allocations of MOZ_HEAP_CLASS, r=ehsan 2015-08-09 12:42:10 -04:00
Michael Layzell
256c460c0c Bug 1192015 - Refactor allocation analysis in clang plugin to better allow adding new analyses, and support detecting temporary value allocations, r=ehsan 2015-08-09 12:42:09 -04:00
Ehsan Akhgari
a2853f82dd Fix some bad variable names, no bug 2015-08-04 19:11:16 -04:00
Michael Layzell
fd765fa5fa Bug 1187073 - Add the MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS annotation to clang-plugin. r=ehsan
--HG--
extra : rebase_source : ecdbc00b315c36420b066792ee3664addecb9812
2015-07-24 12:52:00 -04:00
Michael Layzell
bd071c9515 Bug 1187486 - Update the clang plugin to detect templated implicit constructors; r=ehsan 2015-07-30 20:31:11 -04:00
Ryan VanderMeulen
2ab90188e0 Backed out changeset 3e78fb4512a6 (bug 1187486) for static analysis failures. 2015-07-30 14:47:52 -04:00
Michael Layzell
5644f5a00c Bug 1187486 - Update the clang plugin to detect templated implicit constructors; r=ehsan 2015-07-30 14:03:18 -04:00
Michael Layzell
4fffaa9e34 Bug 602122 - Add a static analysis to find XPCOM classes with duplicate mRefCnt members; r=ehsan 2015-07-30 01:05:06 -04:00
Boris Zbarsky
d0799d6f5c Back out revision 6d94504b602d (bug 602122). 2015-07-28 17:19:46 -04:00
Michael Layzell
259a9c490b Bug 602122 - Add a static analysis to find XPCOM classes with duplicate mRefCnt members; r=ehsan 2015-07-28 16:55:20 -04:00
Michael Layzell
bf91a08bcc Bug 1159433 - Part 1: Add an analysis to ensure that some template arguments cannot be non-memmovable types; r=ehsan 2015-07-24 19:14:37 -04:00
Michael Layzell
91c1e847d6 Bug 1123907 - Part 1: Add an analysis to ensure that a class marked MOZ_NEEDS_NO_VTABLE_TYPE cannot be instantiated by a class with a VTable; r=ehsan 2015-07-24 19:13:52 -04:00
Michael Layzell
7e6901b7fd Bug 1185044 - Unify type annotation logic between MOZ_*_CLASS and MOZ_MUST_USE; r=ehsan 2015-07-24 19:13:15 -04:00
Michael Layzell
2021b2998c Bug 1185188 - Support multiple clang-plugin annotations; r=ehsan 2015-07-24 19:12:54 -04:00
Michael Layzell
f3caaba03f Bug 1180993 - Part 1: Add an analysis to help catch unused return values of specific types. r=ehsan 2015-07-10 09:46:00 -04:00
Botond Ballo
63b921afe7 Bug 1170388 - Restrict the static analysis error given about raw pointers to refcounted objects inside a lambda, to the case where the raw pointer is captured. r=ehsan
--HG--
extra : rebase_source : 28cd2aa684abf505edbcdbc449c8cf056d3b0ee6
extra : source : 28c2862d29b8a2cb0d03cf38430f17abc269225b
2015-06-03 16:51:36 -04:00
Botond Ballo
b197e46728 Backed out d952a7d6bfb4 (bug 1170388) on a CLOSED TREE for static analysis bustage. r=bustage 2015-06-05 00:14:14 -04:00
Botond Ballo
f03fd8179e Bug 1170388 - Restrict the static analysis error given about raw pointers to refcounted objects inside a lambda, to the case where the raw pointer is captured. r=ehsan
--HG--
extra : rebase_source : c76a1dbb2942a07788ec1e87bc5edab79bfee3f5
extra : source : 4abfbfd822789a609c5a7c8c7eef499c776ba489
2015-06-03 16:51:36 -04:00
Ehsan Akhgari
6532f9f013 Bug 1156084 - Disallow AddRef() and Release() calls on the return value of methods returning XPCOM objects; r=jrmuizel
When a method returns type D derived from RefCounted type B, there is an
ImplicitCastExpr (or an ExplicitCastExpr, if there is an explicit cast
to the base type in the code) in the AST between the CallExpr and
MemberExpr, which we didn't take into account before.  This caused the
analysis to not work on common patterns such as
nsCOMPtr<nsIXPCOMInterface>.
2015-05-15 08:39:55 -04:00
Ehsan Akhgari
399276d5fc Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 21:40:49 -04:00
Wes Kocher
638b28b8e0 Backed out changeset 02e6a50741a9 (bug 1153348) to hopefully fix the static bustage CLOSED TREE 2015-04-21 15:47:40 -07:00
Wes Kocher
78060d2f53 Backed out changeset 8b99d282cd87 (bug 1156084) for static bustage CLOSED TREE 2015-04-21 14:23:56 -07:00
Ehsan Akhgari
3d21a05904 Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 16:31:58 -04:00
Ehsan Akhgari
3f4737e49a Bug 1156084 - Disallow AddRef() and Release() calls on the return value of methods returning XPCOM objects; r=jrmuizel
When a method returns type D derived from RefCounted type B, there is an
ImplicitCastExpr (or an ExplicitCastExpr, if there is an explicit cast
to the base type in the code) in the AST between the CallExpr and
MemberExpr, which we didn't take into account before.  This caused the
analysis to not work on common patterns such as
nsCOMPtr<nsIXPCOMInterface>.
2015-04-21 16:24:41 -04:00
Ehsan Akhgari
ac6176637b Bug 1153304 - Add an analysis to prohibit the usage of pointers to refcounted types inside C++ lambdas; r=jrmuizel 2015-04-14 20:55:05 -04:00
Wes Kocher
68ebc60aef Backed out changeset 5f48890c23c1 (bug 1153304) 2015-04-14 16:32:42 -07:00
Ehsan Akhgari
b98cfc5a8e Bug 1153304 - Add an analysis to prohibit the usage of pointers to refcounted types inside C++ lambdas; r=jrmuizel 2015-04-14 18:34:46 -04:00
Ehsan Akhgari
a84e5979ce Bug 1114999 - Part 1: Create an analysis for disallowing calling AddRef and Release on the return value of functions; r=jrmuizel 2015-01-22 17:54:54 -05:00
Nicholas Nethercote
464d8fa62a Bug 1123527 - Initialized some locals in TestNoArithmeticExprInArgument.cpp. r=ehsan.
I think these undefined variables don't matter because it's a static analysis
input, but defining them does stop cppcheck from complaining.

--HG--
extra : rebase_source : 9f663aad5c939af6798cb9a080d25256c3d105fe
2015-01-15 22:16:38 -08:00
Ehsan Akhgari
b2262a1e39 Bug 1123459 - Add an informational note to the diagnostic explaining to use the explicit keyword; r=jrmuizel 2015-01-19 16:39:29 -05:00
Ehsan Akhgari
a402464ce0 Bug 1123429: Allow implicit conversions on abstract C++ classes; r=jrmuizel
Such classes cannot be constructed at all, so worrying about how their
constructors can be invoked is pointless.
2015-01-19 16:38:38 -05:00
Ehsan Akhgari
7afb1a818c Bug 927430 - Add a static analysis to detect is-NaN testing using |x == x| or |x != x|; r=jrmuizel
--HG--
extra : rebase_source : d80c866ecc7e5f415c83db757e82bd4bac299b67
2014-12-21 12:33:25 -05:00
Ehsan Akhgari
fb8a584ff5 Backed out changeset fae8ad41a604 (bug 927430) because of build bustage on a CLOSED TREE 2015-01-18 19:04:23 -05:00
Ehsan Akhgari
c63941d33e Bug 927430 - Add a static analysis to detect is-NaN testing using |x == x| or |x != x|; r=jrmuizel 2015-01-18 18:44:43 -05:00