summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Add cert-oop58-cpp checkGabor Bencze2019-12-151-0/+3
| | | | | | | | The check warns when (a member of) the copied object is assigned to in a copy constructor or copy assignment operator. Based on https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP58-CPP.+Copy+operations+must+not+mutate+the+source+object Differential Revision: https://reviews.llvm.org/D70052
* [clang-tidy] Added DefaultOperatorNewCheck.Balázs Kéri2019-11-191-5/+9
| | | | | | | | | | | | | | | | Summary: Added new checker 'cert-default-operator-new' that checks for CERT rule MEM57-CPP. Simple version. Reviewers: aaron.ballman, alexfh, JonasToth, lebedev.ri Reviewed By: aaron.ballman Subscribers: hiraditya, martong, mehdi_amini, mgorny, inglorion, xazax.hun, dkrupp, steven_wu, dexonsmith, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67545
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread check and its alias ↵Abel Kocsis2019-11-111-0/+4
| | | | cert-pos44-c
* Revert "[clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and ↵Abel Kocsis2019-11-111-4/+0
| | | | | | alias cert-pos44-c" This reverts commit 4edf0cb0e03e31d468979d0d7dec08bd9f4f8204.
* [clang-tidy] Add bugprone-bad-signal-to-kill-thread checker and alias ↵Abel Kocsis2019-11-111-0/+4
| | | | cert-pos44-c
* [clang-tidy]: Add cert-oop54-cpp alias for bugprone-unhandled-self-assignmentTamas Zolnai2019-05-231-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: Added WarnOnlyIfThisHasSuspiciousField option to allow to catch any copy assignment operator independently from the container class's fields. Added the cert alias using this option. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: mgorny, Eugene.Zelenko, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62192 llvm-svn: 361550
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clang-tidy] Re-commit: Add new 'readability-uppercase-literal-suffix' check ↵Roman Lebedev2018-10-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4) Summary: Detects when the integral literal or floating point (decimal or hexadecimal) literal has non-uppercase suffix, and suggests to make the suffix uppercase, with fix-it. All valid combinations of suffixes are supported. ``` auto x = 1; // OK, no suffix. auto x = 1u; // warning: integer literal suffix 'u' is not upper-case auto x = 1U; // OK, suffix is uppercase. ... ``` This is a re-commit, the original was reverted by me in rL345305 due to discovered bugs. (implicit code, template instantiation) Tests were added, and the bugs were fixed. I'm unable to find any further bugs, hopefully there aren't any.. References: * [[ https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152241 | CERT DCL16-C ]] * MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix * MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case Reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52670 llvm-svn: 345381
* [clang-tidy] Revert my readability-uppercase-literal-suffix check.Roman Lebedev2018-10-251-10/+0
| | | | | | | | | | There are some lurking issues with the handling of the SourceManager. Somehow sometimes we end up extracting completely wrong portions of the source buffer. Reverts r344772, r44760, r344758, r344755. llvm-svn: 345305
* [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT ↵Roman Lebedev2018-10-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4) Summary: Detects when the integral literal or floating point (decimal or hexadecimal) literal has non-uppercase suffix, and suggests to make the suffix uppercase, with fix-it. All valid combinations of suffixes are supported. ``` auto x = 1; // OK, no suffix. auto x = 1u; // warning: integer literal suffix 'u' is not upper-case auto x = 1U; // OK, suffix is uppercase. ... ``` References: * [[ https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152241 | CERT DCL16-C ]] * MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix * MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case Reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52670 llvm-svn: 344755
* Add the cert-msc51-cpp and cert-msc32-c checks.Aaron Ballman2018-07-051-0/+5
| | | | | | | | These checks flag use of random number generators with poor seeds that would possibly lead to degraded random number generation. Patch by Borsik Gábor llvm-svn: 336301
* [clang-tidy] Move checks from misc- to performance-Alexander Kornienko2017-11-271-2/+2
| | | | | | | | | | | | | | | | Summary: rename_check.py misc-move-constructor-init performance-move-constructor-init rename_check.py misc-inefficient-algorithm performance-inefficient-algorithm Reviewers: hokein, aaron.ballman Reviewed By: hokein, aaron.ballman Subscribers: aaron.ballman, mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D40487 llvm-svn: 319023
* [clang-tidy] Add new cert-dcl21-cpp check Gabor Horvath2017-05-101-0/+3
| | | | | | | | | This check flags postfix operator++/-- declarations, where the return type is not a const object. Differential Revision: https://reviews.llvm.org/D32743 llvm-svn: 302637
* [clang-tidy] Add cert-dcl58-cpp (do not modify the 'std' namespace) check.Gabor Horvath2017-02-171-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D23421 llvm-svn: 295435
* [clang-tidy] Remove duplicated check from move-constructor-initMalcolm Parsons2016-12-171-5/+0
| | | | | | | | | | | | | | | | | | | | Summary: An addition to the move-constructor-init check was duplicating the modernize-pass-by-value check. Remove the additional check and UseCERTSemantics option. Run the move-constructor-init test with both checks enabled. Fix modernize-pass-by-value false-positive when initializing a base class. Add option to modernize-pass-by-value to only warn about parameters that are already values. Reviewers: alexfh, flx, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26453 llvm-svn: 290051
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-24/+13
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* Add a new clang-tidy check for cert-msc50-cpp (and cert-msc30-c) that ↵Aaron Ballman2016-11-021-0/+7
| | | | | | | | corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers Patch by Benedek Kiss llvm-svn: 285809
* [clang-tidy] Add cert-err09-cpp check alias.Marek Kurdej2016-10-191-0/+2
| | | | | | | | | | | | Summary: This adds cert-err09-cpp alias for completeness, similar to cert-err61-cpp. Reviewers: alexfh, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25770 llvm-svn: 284596
* [clang-tidy] Switch to a more common way of customizing check behavior.Alexander Kornienko2016-05-201-0/+5
| | | | | | | This should have been done this way from the start, however I somehow missed r257177. llvm-svn: 270215
* [clang-tidy] Cleaning namespaces to be more consistant across checkers.Etienne Bergeron2016-05-021-4/+4
| | | | | | | | | | | | | | Summary: The goal of the patch is to bring checkers in their appropriate namespace. This path doesn't change any behavior. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19811 llvm-svn: 268264
* Add a clang-tidy check that flags string-to-number conversion functions that ↵Aaron Ballman2016-04-291-0/+4
| | | | | | | | have insufficient error checking, suggesting a better alternative. This check corresponds to: https://www.securecoding.cert.org/confluence/display/c/ERR34-C.+Detect+errors+when+converting+a+string+to+a+number llvm-svn: 268100
* Add a new check, cert-env33-c, that diagnoses uses of system(), popen(), and ↵Aaron Ballman2016-02-221-0/+4
| | | | | | _popen() to execute a command processor. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=2130132 llvm-svn: 261530
* Add a new check, cert-flp30-c, that diagnoses loop induction expressions of ↵Aaron Ballman2016-02-191-1/+4
| | | | | | floating-point type. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FLP30-C.+Do+not+use+floating-point+variables+as+loop+counters llvm-svn: 261324
* Rename the CERT namespace to cert, and update some checkers to use this ↵Aaron Ballman2016-01-041-3/+3
| | | | | | | | namespace consistently. Patch thanks to Haojian Wu! llvm-svn: 256756
* Add a new checker, cert-err58-cpp, that checks for static or thread_local ↵Aaron Ballman2015-12-011-0/+3
| | | | | | | | objects that use a throwing constructor. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR58-CPP.+Constructors+of+objects+with+static+or+thread+storage+duration+must+not+throw+exceptions llvm-svn: 254415
* Add a new clang-tidy checker that flags throw expressions whose thrown type ↵Aaron Ballman2015-11-161-0/+3
| | | | | | | | is not nothrow copy constructible. While the compiler is free to elide copy constructor calls in some cases, it is under no obligation to do so, which makes the code a portability concern as well as a security concern. This checker corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible llvm-svn: 253246
* Exposing an existing checker under the name cert-err61-cpp, as it ↵Aaron Ballman2015-10-131-0/+3
| | | | | | corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR61-CPP.+Catch+exceptions+by+lvalue+reference llvm-svn: 250221
* Adding a checker (cert-err52-cpp) that detects use of setjmp or longjmp in ↵Aaron Ballman2015-10-081-0/+4
| | | | | | C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=1834 llvm-svn: 249727
* Adding a checker (cert-dcl50-cpp) that detects the definition of a C-style ↵Aaron Ballman2015-10-051-0/+3
| | | | | | variadic function in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL50-CPP.+Do+not+define+a+C-style+variadic+function llvm-svn: 249343
* Adding a new clang-tidy module to house CERT-specific checkers, and map ↵Aaron Ballman2015-10-021-0/+59
existing checkers to CERT secure coding rules and recommendations for both C (https://www.securecoding.cert.org/confluence/display/c/SEI+CERT+C+Coding+Standard) and C++ (https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=637). llvm-svn: 249130
OpenPOWER on IntegriCloud