summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/cert
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Add cert-oop58-cpp checkGabor Bencze2019-12-154-0/+122
| | | | | | | | 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-194-5/+119
| | | | | | | | | | | | | | | | 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-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clang-tidy]: Add cert-oop54-cpp alias for bugprone-unhandled-self-assignmentTamas Zolnai2019-05-232-0/+5
| | | | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Switch checks to #include "ClangTidyCheck.h"Alexander Kornienko2019-03-2511-11/+11
| | | | llvm-svn: 356892
* [clang-tidy] Move all checks to the new registerPPCallbacks APIAlexander Kornienko2019-03-222-4/+6
| | | | llvm-svn: 356796
* [clang-tidy] anyOf(hasName(..), hasName(..)) -> hasAnyNameAlexander Kornienko2019-03-222-9/+7
| | | | | | + a minor style fix llvm-svn: 356792
* Fix file headers. NFCFangrui Song2019-03-013-3/+3
| | | | llvm-svn: 355188
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1923-92/+69
| | | | | | | | | | | | | | | | | 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
* Install new LLVM license structure and new developer policy.Chandler Carruth2019-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This installs the new developer policy and moves all of the license files across all LLVM projects in the monorepo to the new license structure. The remaining projects will be moved independently. Note that I've left odd formatting and other idiosyncracies of the legacy license structure text alone to make the diff easier to read. Critically, note that we do not in any case *remove* the old license notice or terms, as that remains necessary until we finish the relicensing process. I've updated a few license files that refer to the LLVM license to instead simply refer generically to whatever license the LLVM project is under, basically trying to minimize confusion. This is really the culmination of so many people. Chris led the community discussions, drafted the policy update and organized the multi-year string of meeting between lawyers across the community to figure out the strategy. Numerous lawyers at companies in the community spent their time figuring out initial answers, and then the Foundation's lawyer Heather Meeker has done *so* much to help refine and get us ready here. I could keep going on, but I just want to make sure everyone realizes what a huge community effort this has been from the begining. Differential Revision: https://reviews.llvm.org/D56897 llvm-svn: 351631
* Fix false positive with lambda assignments in cert-err58-cpp.Aaron Ballman2018-11-281-1/+2
| | | | | | This check is about preventing exceptions from being thrown before main() executes, and assigning a lambda (rather than calling it) to a global object cannot throw any exceptions. llvm-svn: 347761
* Re-commit r347419 "Update call to EvaluateAsInt() to the new syntax."Hans Wennborg2018-11-281-2/+2
| | | | llvm-svn: 347757
* Fix a false-positive with cert-err58-cpp.Aaron Ballman2018-11-281-1/+1
| | | | | | If a variable is declared constexpr then its initializer needs to be a constant expression, and thus, cannot throw. This check is about not throwing exceptions before main() runs, and so it doesn't apply if the initializer cannot throw. This silences the diagnostic when initializing a constexpr variable and fixes PR35457. llvm-svn: 347745
* Revert r347419 "Update call to EvaluateAsInt() to the new syntax."Hans Wennborg2018-11-271-2/+2
| | | | | | It's pre-requisite was reverted in r347656. llvm-svn: 347657
* [clang-tidy] Ignore matches in template instantiations (cert-dcl21-cpp)Alexander Kornienko2018-11-231-1/+2
| | | | | | | | The test fails with a local modification to clang-tidy/ClangTidyDiagnosticConsumer.cpp to include fixes into the key when deduplicating the warnings. llvm-svn: 347495
* Update call to EvaluateAsInt() to the new syntax.Bill Wendling2018-11-211-2/+2
| | | | llvm-svn: 347419
* Revert 347366, its prerequisite 347364 got reverted.Nico Weber2018-11-211-2/+2
| | | | llvm-svn: 347390
* Update EvaluateAsInt to the new syntax.Bill Wendling2018-11-201-2/+2
| | | | llvm-svn: 347366
* Reapply Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-022-2/+1
| | | | | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. This also moves the OSLog and other FormatString helpers from libclangAnalysis to libclangAST to avoid a circular dependency. llvm-svn: 345971
* Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off buildsFangrui Song2018-11-021-2/+2
| | | | llvm-svn: 345951
* [clang-tidy] Re-commit: Add new 'readability-uppercase-literal-suffix' check ↵Roman Lebedev2018-10-262-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-252-11/+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-182-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* Add the cert-msc51-cpp and cert-msc32-c checks.Aaron Ballman2018-07-054-0/+177
| | | | | | | | 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] Fix link error in clang-tidy after the recent check renames.Alexander Kornienko2017-11-271-0/+1
| | | | llvm-svn: 319034
* [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] When" -fno-exceptions is used", this warning is better to be ↵Yan Wang2017-06-071-1/+1
| | | | | | | | | | | | | | | | | | suppressed. Summary: clang-tidy is better not to issues this warning, which checks where the initializer for the object may throw an exception, when "-fno-exceptions" is used. Reviewers: chh, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33917 llvm-svn: 304931
* [clang-tidy] Add new cert-dcl21-cpp check Gabor Horvath2017-05-104-0/+128
| | | | | | | | | 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-174-0/+89
| | | | | | 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-085-30/+17
| | | | | | | | | | | | | | | | 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-024-0/+86
| | | | | | | | 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] Update cert-err58-cpp to match its new generalised form.Malcolm Parsons2016-10-311-8/+18
| | | | | | | | | | | | | | Summary: Aaron modified cert-err58-cpp to include all exceptions thrown before main() Update the check to match. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25925 llvm-svn: 285653
* [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] Use ignoreImplicit in cert-err58-cpp checkMalcolm Parsons2016-10-161-2/+2
| | | | | | | | | | | | | | Summary: Fix a false negative in cert-err58-cpp check when calling a constructor creates objects that require cleanup. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25642 llvm-svn: 284332
* Silence a false positive with the cert-err58-cpp check; now allows objects ↵Aaron Ballman2016-09-261-2/+2
| | | | | | | | with static or thread storage duration at function block scope. Patch by Malcolm Parsons llvm-svn: 282409
* [clang-tidy] Cleaning up language options.Gabor Horvath2016-09-241-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D24881 llvm-svn: 282319
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-012-2/+2
| | | | llvm-svn: 277340
* [ASTMatchers] Added ignoringParenImpCasts to has matchersPiotr Padlewski2016-05-311-4/+4
| | | | | | | | | has matcher changed behaviour, and now it matches "as is" and doesn't skip implicit and paren casts http://reviews.llvm.org/D20801 llvm-svn: 271289
* [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-294-0/+277
| | | | | | | | 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-224-0/+88
| | | | | | _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-194-1/+77
| | | | | | 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
* Remove autoconf supportChris Bieneman2016-01-261-12/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "Now I am become Death, the destroyer of worlds." -J. Robert Oppenheimer Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D16475 llvm-svn: 258864
* Rename the CERT namespace to cert, and update some checkers to use this ↵Aaron Ballman2016-01-049-10/+20
| | | | | | | | namespace consistently. Patch thanks to Haojian Wu! llvm-svn: 256756
OpenPOWER on IntegriCloud