Commit Graph

34 Commits

Author SHA1 Message Date
Andi-Bogdan Postelnicu
34a6c4ff8f Bug 1466427 - Migrate clang-tidy package from 5.0.1 to 7.0.0-rc2. r=glandium,janx
Differential Revision: https://phabricator.services.mozilla.com/D3980

--HG--
rename : tools/clang-tidy/test/misc-bool-pointer-implicit-conversion.cpp => tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp
rename : tools/clang-tidy/test/misc-forward-declaration-namespace.cpp => tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp
rename : tools/clang-tidy/test/misc-macro-repeated-side-effects.cpp => tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp
rename : tools/clang-tidy/test/misc-string-constructor.cpp => tools/clang-tidy/test/bugprone-string-constructor.cpp
rename : tools/clang-tidy/test/misc-string-integer-assignment.cpp => tools/clang-tidy/test/bugprone-string-integer-assignment.cpp
rename : tools/clang-tidy/test/misc-suspicious-missing-comma.cpp => tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp
rename : tools/clang-tidy/test/misc-swapped-arguments.cpp => tools/clang-tidy/test/bugprone-swapped-arguments.cpp
rename : tools/clang-tidy/test/misc-unused-raii.cpp => tools/clang-tidy/test/bugprone-unused-raii.cpp
extra : moz-landing-system : lando
2018-08-24 12:39:58 +00:00
Sylvestre Ledru
d8cf7f225f Bug 1477979 - Add the name of the clang-tidy 6.0 as a comment r=janx
Differential Revision: https://phabricator.services.mozilla.com/D2291

--HG--
extra : moz-landing-system : lando
2018-07-24 12:15:04 +00:00
Andi-Bogdan Postelnicu
2132bcd260 Bug 1476762 - Declare strcat, strlen and size_t to use appropriate types in declaration, definition. r=janx
MozReview-Commit-ID: 7JuATmROVVr

--HG--
extra : rebase_source : f798a188a521b76a5ed15913d24733324602820e
2018-07-18 22:59:10 +03:00
Chris Peterson
05d177e56a Bug 1475882 - clang-tidy: Enable misc-string-integer-assignment check. r=andi
The check finds assignments of an integer to std::string:

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-integer-assignment.html

There are currently ten misc-string-integer-assignment warnings in mozilla-central, but they are all in third-party Breakpad code:

toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:306:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:307:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:309:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:310:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:311:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:313:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:314:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:315:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility
toolkit/crashreporter/google-breakpad/src/processor/minidump.cc:316:17: warning: an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility

MozReview-Commit-ID: AUOyOuCzy1R

--HG--
extra : source : 93356b5c58539d19c27dade7b1514bae709bc149
extra : histedit_source : 4bc38ab5a7a50869aaf4fce87aa2f75ce9dd301a
2018-07-14 23:48:40 -07:00
Chris Peterson
126761ba3c Bug 1475882 - clang-tidy: Enable misc-string-constructor check. r=andi
Finds string constructors that are suspicious and probably errors. There are currently no misc-string-constructor warnings in mozilla-central!

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-constructor.html

MozReview-Commit-ID: LyJt6wqOhg9

--HG--
extra : source : 0b36b6b1b7931adec5846086a52080edb3ec5e7d
extra : histedit_source : 30249980b219d4813fc5503c87e84265ad354e2f
2018-07-14 23:41:55 -07:00
Chris Peterson
59cd83d07a Bug 1475882 - clang-tidy: Enable bugprone-suspicious-memset-usage check. r=andi
This check finds memset() calls with potential mistakes in their arguments. There are currently no bugprone-suspicious-memset-usage warnings in mozilla-central!

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html

MozReview-Commit-ID: 9gmtidgMPwW

--HG--
extra : source : 9c6f6e1553c45751f476c2d8418b9d4735e27e50
extra : histedit_source : 721536e24babf3734e116bd6beaf8d43722cca96
2018-07-08 23:54:13 -07:00
Chris Peterson
9574957168 Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.Malloc check. r=andi
Check for memory leaks, double free, and use-after-free and offset problems involving malloc. There are currently no clang-analyzer-unix.Malloc warnings in mozilla-central!

https://clang-analyzer.llvm.org/available_checks.html

MozReview-Commit-ID: G32SlokD64O

--HG--
extra : source : a2c8ccd2da1968b64510569f12f4631c54fea2d8
extra : histedit_source : b42c3ce2c3f8132fc0b301e6309b5ad25192167c
2018-07-14 23:28:26 -07:00
Chris Peterson
a1aecf2da2 Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.NullArg check. r=andi
Check for null pointers being passed as arguments to C string functions. There are no clang-analyzer-unix.cstring.NullArg warnings in mozilla-central!

strlen
strnlen
strcpy
strncpy
strcat
strncat
strcmp
strncmp
strcasecmp
strncasecmp

https://clang-analyzer.llvm.org/available_checks.html

MozReview-Commit-ID: EkfaItfo5cu

--HG--
extra : source : e05c6cfa3b8ae6b3234ebf5e4895475bc623edcd
extra : histedit_source : 6aa97bb8d82884fb2ac92793df9defd7a7985e89
2018-07-14 22:07:12 -07:00
Chris Peterson
ced65109b9 Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.BadSizeArg check. r=andi
Check the size argument passed to strncat for common erroneous patterns. There are currently no clang-analyzer-unix.cstring.BadSizeArg warnings in mozilla-central!

https://clang-analyzer.llvm.org/available_checks.html

MozReview-Commit-ID: DUI3ZNIBoLQ

--HG--
extra : source : 8dafc73215cddd2737b4d8dbcb926521736d98c2
extra : histedit_source : ed27a98e47c01c9951c03eb2129ed4997f3cf624
2018-07-14 23:15:37 -07:00
Chris Peterson
6f691d73b1 Bug 1475882 - clang-tidy: Enable misc-unused-alias-decls check. r=andi
This check finds unused namespace alias declarations. There are currently no misc-unused-alias-decls warnings in mozilla-central!

https://clang.llvm.org/extra/clang-tidy/checks/misc-unused-alias-decls.html

MozReview-Commit-ID: LHziGESvaM5

--HG--
extra : rebase_source : f10fbb6364bc947b5fa2ca8c0b47494519856940
extra : source : 987ca732290093c4bd36690c6ebd3ed2ac0b5444
2018-07-09 11:04:31 -07:00
Chris Peterson
6d8a23d9c8 Bug 1475882 - clang-tidy: Enable misc-swapped-arguments check. r=andi
This check finds potentially swapped function arguments by looking at implicit conversions. There are currently no misc-swapped-arguments warnings in mozilla-central!

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-swapped-arguments.html

MozReview-Commit-ID: 6SETUcQhQP

--HG--
extra : rebase_source : d364fc90e776807ab2540d714594d07a5a83b054
extra : source : 689980bf12e98780d0d60c851549d16a4cc8efb0
2018-07-09 00:26:58 -07:00
Chris Peterson
d9fe858d74 Bug 1475882 - clang-tidy: Enable misc-macro-repeated-side-effects check. r=andi
This check finds side effects from repeated macro arguments:

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-macro-repeated-side-effects.html

There are currently 16 misc-macro-repeated-side-effects warnings in mozilla-central, but they are all in third-party gfx/cairo code:

gfx/cairo/cairo/src/cairo-tor-scan-converter.c:1432:10: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1011:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1037:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1062:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1088:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1107:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1126:27: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1194:21: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:1258:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:600:28: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:629:28: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:660:28: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:690:28: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:721:28: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-access.c:986:16: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion
gfx/cairo/libpixman/src/pixman-edge-imp.h:126:20: warning: side effects in the 2nd macro argument 'ptr' are repeated in macro expansion

MozReview-Commit-ID: CQ6iO9JO773

--HG--
extra : rebase_source : 0e7dc6fa3990ab187c597d8042a403c554152b02
extra : source : 5f47d400d53107df0e0478b369745bfd3f055702
2018-07-09 10:14:40 -07:00
Chris Peterson
557f9a3436 Bug 1475882 - clang-analyzer: Enable clang-analyzer-cplusplus.NewDeleteLeaks check. r=andi
Check for memory leaks. Traces memory managed by new/ delete. There are currently no clang-analyzer-cplusplus.NewDeleteLeaks warnings in mozilla-central!

https://clang-analyzer.llvm.org/available_checks.html

MozReview-Commit-ID: 3tmwR26UB8K

--HG--
extra : rebase_source : 3796cc6b61c03e83ce8b390e3342b870085b2ed2
extra : source : 3389fb54d2e3daee38db38503b37e9d994878bcd
2018-07-14 23:10:39 -07:00
Chris Peterson
11ee6d0d0c Bug 1475882 - clang-analyzer: Enable clang-analyzer-cplusplus.NewDelete check. r=andi
Check for double-free, use-after-free and offset problems involving C++ delete. There are currently no clang-analyzer-cplusplus.NewDelete warnings in mozilla-central!

https://clang-analyzer.llvm.org/available_checks.html

MozReview-Commit-ID: 9sVp4fc4JTj

--HG--
extra : rebase_source : 733974ff07b873f6e5cd1e83104f82eafbf7f3c7
extra : source : 778684b276e6658fb9f3fa125aaec984cca8760a
2018-07-14 23:07:40 -07:00
Chris Peterson
4ab09c5491 Bug 1473217 - Part 3: clang-tidy: Enable misc-unused-raii check. r=andi
Finds temporaries that look like RAII objects.

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html

MozReview-Commit-ID: KDYoF3YEbMu

--HG--
extra : rebase_source : 294b56106e9b44a5dd9b9a1778877921df0cf698
extra : intermediate-source : ca55794cb22c35c9cf1f29ff06e32cbcbb22230f
extra : source : 4b59f7e733d31e28a700213ad63d3581951ccc05
2018-07-02 10:52:35 -07:00
Chris Peterson
0c426c313c Bug 1473453 - Part 3: Enable clang-tidy's misc-bool-pointer-implicit-conversion warning. r=andi
And add a clang-tidy test.

MozReview-Commit-ID: KmCgrUcV0Lm

--HG--
extra : rebase_source : 0fad2e49472c565f59ba4218a6dc3099cca9d9cb
2018-07-04 19:30:33 -07:00
Andi-Bogdan Postelnicu
b61fe0d579 Bug 1471285 - [Clang-Tidy 5.0.1] Checker misc-suspicious-missing-comma has faulty test case. r=janx
MozReview-Commit-ID: 2COIi47WQBO

--HG--
extra : rebase_source : 4ea6e4cb26cad89a94f8453ca811daa895588bbf
2018-06-26 17:44:44 +01:00
Jan Keromnes
a4701a58b0 Bug 1468811 - Re-enable clang-tidy check performance-faster-string-find. r=sylvestre
It already had test files, but wasn't actually enabled. Also add a mock internal
std::string::find signature; two comments about disabled checks; and fix a typo.
2018-06-19 08:08:00 +03:00
Jan Keromnes
e346734256 Bug 1468811 - Sort clang-tidy checks alphabetically in tools/clang-tidy/config.yaml. r=sylvestre 2018-06-19 08:06:00 +03:00
Andi-Bogdan Postelnicu
0374067886 Bug 1432410 - Add tests in tree to make sure we don't regress with clang-tidy on static-analisys. Tests wrote in part by :sylvestre. r=gps
MozReview-Commit-ID: IWxzKfWNIHG

--HG--
extra : rebase_source : d2bd65c66541e5d6e8d5cc721b117f0a3e7716e8
2018-05-03 20:06:16 +03:00
Sylvestre Ledru
f5ce701429 Bug 1452098 - Remove the checker clang-analyzer-security.insecureAPI.gets r=andi
No longer in the C++11 standard

MozReview-Commit-ID: IdditTVKWtM

--HG--
extra : rebase_source : 00871a85f9e99d7ce36b397803b510a5ec8db530
2018-04-06 16:09:20 +02:00
Sylvestre Ledru
e953fc6e58 Bug 1451316 - Rename clang-analyzer-security.UncheckedReturn to the correct name r=andi
MozReview-Commit-ID: DRPiNknhnGZ

--HG--
extra : rebase_source : f9b3c90214c74c7787324773b770342440d60c89
2018-04-04 14:53:42 +02:00
Sylvestre Ledru
814ab89b8a Bug 1451331 - Fix the name of the checkers as we are using clang-tidy 5.0 r=andi
MozReview-Commit-ID: 69gV9gsCZah

--HG--
extra : rebase_source : 4a8e6d817fb646a3579df8e71aded6579fcde2c7
2018-04-04 15:42:58 +02:00
Sylvestre Ledru
ec0beeca80 Bug 1436354 - Enable modernize-use-bool-literals at review phase r=Ehsan
This won't warn about existing defects.

MozReview-Commit-ID: Fra6TmTREf2

--HG--
extra : rebase_source : 83a390edfbc68201a39c18cc618b304431163483
2018-02-07 15:14:32 +01:00
Sylvestre Ledru
6062c401f8 Bug 1437891 - Enable readability-redundant-string-cstr & readability-redundant-string-init checkers r=andi
MozReview-Commit-ID: 1QliseFa1mC

--HG--
extra : rebase_source : 0d8038d5678515d11a73e00870a618017348c011
2018-02-13 16:23:29 +01:00
Andi-Bogdan Postelnicu
48cbb200aa Bug 1430749 - Update the list of checkers in config.yaml to add some clang-analyzer-security checks. r=janx
MozReview-Commit-ID: BkccyEOktHS

--HG--
extra : rebase_source : 58193ed0350f2bb51474b02f824696fcc900ce6e
2018-01-16 14:43:05 +02:00
Sylvestre Ledru
96903a4e47 Bug 1422363 - Enable readability-static-accessed-through-instance in the static analysis r=andi
MozReview-Commit-ID: H65g81ZCSfp

--HG--
extra : rebase_source : 37797c334c55e3679026801e19d28ed8b49a3b4c
2017-12-01 19:12:49 +01:00
Sylvestre Ledru
b1ad4c3c99 Bug 1422628 - enable bugprone-forward-declaration-namespace in the static analysis r=andi
MozReview-Commit-ID: LHvTVoyy81A

--HG--
extra : rebase_source : bc9a03323ef635a55b2b38297a8d61ca3d8e8320
2017-12-03 22:54:04 +01:00
Andi-Bogdan Postelnicu
e213dce5f0 Bug 1420366 - remove modernize-use-override from clang-bot config. r=sylvestre
MozReview-Commit-ID: IEZ7NxP9pXe

--HG--
extra : rebase_source : e15d67bba37ddb54c20f6ad37ce99469eb9fe742
2017-11-24 12:26:32 +02:00
Sylvestre Ledru
90533210dc Bug 1415845 - Enable two more clang-tidy checkers: misc-unused-using-decls & misc-argument-comment r=andi
MozReview-Commit-ID: CXjGaqIdHan

--HG--
extra : rebase_source : 21dc4763d0a2f183d3946911dfaf5d68c834729c
2017-11-09 12:03:27 +01:00
Sylvestre Ledru
b470a9a929 Bug 1411960 - Enable modernize-avoid-bind to recommend using lambda instead of std::bind r=andi
MozReview-Commit-ID: C9bOP9SxFan

--HG--
extra : rebase_source : 352bf343efeb26593b451bee4863e08838a93a5b
2017-10-26 15:09:54 +02:00
Andi-Bogdan Postelnicu
88b1f10b9f Bug 1402302 - sync checkers for static-analysis with the mozreview bot. r=sylvestre
MozReview-Commit-ID: I5rn4DEXGOK

--HG--
extra : rebase_source : 049079671c84a670718cf2efa2bd1a8c851446cc
2017-09-30 14:54:58 +03:00
Wes Kocher
2d79871195 Backed out changeset 048af66f7711 (bug 1402302) for lint issues in config.yaml a=backout
MozReview-Commit-ID: 8vkN5D8YVks
2017-09-29 14:23:59 -07:00
Andi-Bogdan Postelnicu
c182f3e18d Bug 1402302 - sync checkers for static-analysis with the mozreview bot. r=sylvestre
MozReview-Commit-ID: I5rn4DEXGOK

--HG--
extra : rebase_source : 880d5ed66b45ca3de83b12561bf1a75eb5f1b198
2017-09-29 23:48:19 +03:00