summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Recommit r360345 with fixes (was reverted in r360348).Aaron Ballman2019-05-101-0/+3
| | | | | | | | Add the modernize-use-trailing-return check to rewrite function signatures to use trailing return types. Patch by Bernhard Manfred Gruber. llvm-svn: 360438
* Revert r360345 and r360346, as they are not passing the testbots.Aaron Ballman2019-05-091-3/+0
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/48063/steps/test/logs/stdio llvm-svn: 360348
* Add the modernize-use-trailing-return check to rewrite function signatures ↵Aaron Ballman2019-05-091-0/+3
| | | | | | | | to use trailing return types. Patch by Bernhard Manfred Gruber. llvm-svn: 360345
* 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] Adding a new modernize use nodiscard checkerJonas Toth2019-01-091-0/+3
| | | | | | | | | | | | | | | | | | Summary: Adds a checker to clang-tidy to warn when a non void const member function, taking only parameters passed by value or const reference could be marked as '[[nodiscard]]' Patch by MyDeveloperDay. Reviewers: alexfh, stephenkelly, curdeius, aaron.ballman, hokein, JonasToth Reviewed By: curdeius, JonasToth Subscribers: Eugene.Zelenko, lefticus, lebedev.ri, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55433 llvm-svn: 350760
* [clang-tidy] Avoid C arrays checkRoman Lebedev2018-11-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: [[ https://bugs.llvm.org/show_bug.cgi?id=39224 | PR39224 ]] As discussed, we can't always do the transform automatically due to that array-to-pointer decay of C array. In order to detect whether we can do said transform, we'd need to be able to see all usages of said array, which is, i would say, rather impossible if e.g. it is in the header. Thus right now no fixit exists. Exceptions: `extern "C"` code. References: * [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es27-use-stdarray-or-stack_array-for-arrays-on-the-stack | CPPCG ES.27: Use std::array or stack_array for arrays on the stack ]] * [[ https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#slcon1-prefer-using-stl-array-or-vector-instead-of-a-c-array | CPPCG SL.con.1: Prefer using STL array or vector instead of a C array ]] * HICPP `4.1.1 Ensure that a function argument does not undergo an array-to-pointer conversion` * MISRA `5-2-12 An identifier with array type passed as a function argument shall not decay to a pointer` Reviewers: aaron.ballman, JonasToth, alexfh, hokein, xazax.hun Reviewed By: JonasToth Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D53771 llvm-svn: 346835
* [clang-tidy] Replace deprecated std::ios_base aliasesJonas Toth2018-10-051-0/+3
| | | | | | | | | | | | | This check warns the uses of the deprecated member types of std::ios_base and replaces those that have a non-deprecated equivalent. Patch by andobence! Reviewd by: alexfh Revision ID: https://reviews.llvm.org/D51332 llvm-svn: 343848
* [clang-tidy] Add modernize-concat-nested-namespaces checkJonas Toth2018-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds instances of namespaces concatenated using explicit syntax, such as `namespace a { namespace b { [...] }}` and offers fix to glue it to `namespace a::b { [...] }`. Properly handles `inline` and unnamed namespaces. ~~Also, detects empty blocks in nested namespaces and offers to remove them.~~ Test with common use cases included. I ran the check against entire llvm repository. Except for expected `nested namespace definitions only available with -std=c++17 or -std=gnu++17` warnings I noticed no issues when the check was performed. Example: ``` namespace a { namespace b { void test(); }} ``` can become ``` namespace a::b { void test(); } ``` Patch by wgml! Reviewers: alexfh, aaron.ballman, hokein Reviewed By: aaron.ballman Subscribers: JonasToth, Eugene.Zelenko, lebedev.ri, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52136 llvm-svn: 343000
* [clang-tidy] Replace the usage of std::uncaught_exception with ↵Gabor Horvath2018-02-201-0/+3
| | | | | | | | | | std::uncaught_exceptions Patch by: Daniel Kolozsvari! Differential Revision: https://reviews.llvm.org/D40787 llvm-svn: 325572
* [clang-tidy] Add new modernize use unary assert checkGabor Horvath2017-07-121-0/+3
| | | | | | | | Patch by: Lilla Barancsuk Differential Revision: https://reviews.llvm.org/D35257 llvm-svn: 307791
* [clang-tidy] New checker to replace dynamic exception specificationsAlexander Kornienko2017-06-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: New checker to replace dynamic exception specifications This is an alternative to D18575 which relied on reparsing the decl to find the location of dynamic exception specifications, but couldn't deal with preprocessor conditionals correctly without reparsing the entire file. This approach uses D20428 to find dynamic exception specification locations and handles all cases correctly. Reviewers: aaron.ballman, alexfh Reviewed By: aaron.ballman, alexfh Subscribers: xazax.hun, mgehre, malcolm.parsons, mgorny, JDevlieghere, cfe-commits, Eugene.Zelenko, etienneb Patch by Don Hinton! Differential Revision: https://reviews.llvm.org/D20693 llvm-svn: 304977
* [clang-tidy] New check: modernize-replace-random-shuffle.Mads Ravn2017-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | This check will find occurrences of ``std::random_shuffle`` and replace it with ``std::shuffle``. In C++17 ``std::random_shuffle`` will no longer be available and thus we need to replace it. Example of case that it fixes ``` std::vector<int> v; // First example std::random_shuffle(vec.begin(), vec.end()); ``` Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons, mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30158 llvm-svn: 301167
* [clang-tidy] Add check 'modernize-return-braced-init-list'Jonas Devlieghere2017-02-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Replaces explicit calls to the constructor in a return with a braced initializer list. This way the return type is not needlessly duplicated in the return type and the return statement. ``` Foo bar() { Baz baz; return Foo(baz); } // transforms to: Foo bar() { Baz baz; return {baz}; } ``` Reviewers: hokein, Prazek, aaron.ballman, alexfh Reviewed By: Prazek, aaron.ballman, alexfh Subscribers: malcolm.parsons, mgorny, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D28768 llvm-svn: 295199
* Revert "Implement a new clang-tidy check that suggests users replace dynamic ↵Diana Picus2017-01-271-2/+0
| | | | | | | | | exception specifications with noexcept exception specifications." This reverts commit r293217, its follow-up 293218 and part of 293234 because it broke all bots that build clang-tools-extra. llvm-svn: 293267
* Implement a new clang-tidy check that suggests users replace dynamic ↵Aaron Ballman2017-01-261-0/+2
| | | | | | | | exception specifications with noexcept exception specifications. Patch by Don Hinton. llvm-svn: 293217
* [clang-tidy] Add modernize-use-default-member-init checkMalcolm Parsons2016-12-201-0/+3
| | | | | | | | | | | | Summary: Fixes PR18858 Reviewers: alexfh, hokein, aaron.ballman Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, modocache Differential Revision: https://reviews.llvm.org/D26750 llvm-svn: 290202
* [clang-tidy] Rename modernize-use-default to modernize-use-equals-defaultMalcolm Parsons2016-12-011-2/+2
| | | | | | | | | | Reviewers: angelgarcia, aaron.ballman, alexfh Subscribers: JDevlieghere, Prazek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D26511 llvm-svn: 288375
* [clang-tidy] New check to prefer transparent functors to non-transparent ones.Gabor Horvath2016-11-161-0/+3
| | | | llvm-svn: 287107
* [clang-tidy] Add modernize-use-equals-delete checkMalcolm Parsons2016-11-101-0/+3
| | | | | | | | | | | | Summary: Fixes PR27872 Reviewers: klimek, hokein, alexfh, aaron.ballman Subscribers: Prazek, Eugene.Zelenko, danielmarjamaki, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D26138 llvm-svn: 286472
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-2/+1
| | | | | | | | | | | | | | | | 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
* [clang-tidy] Add modernize-use-usingKrystyna Gajczyk2016-06-251-0/+2
| | | | | | http://reviews.llvm.org/D18919 llvm-svn: 273786
* [clang-tidy] Add modernize-use-emplacePiotr Padlewski2016-06-211-0/+2
| | | | | | | | | | Summary: Add check that replaces call of push_back to emplace_back Reviewers: hokein Differential Revision: http://reviews.llvm.org/D20964 llvm-svn: 273275
* [clang-tidy] Adds modernize-avoid-bind checkJonathan Coe2016-05-121-0/+3
| | | | | | | | | | | | | | | Summary: This patch adds a check that replaces std::bind with a lambda. Not yet working for member functions. Reviewers: aaron.ballman, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16962 llvm-svn: 269341
* [clang-tidy] Adds modernize-use-bool-literals check.Jakub Staron2016-05-111-0/+3
| | | | | | Review link: http://reviews.llvm.org/D18745 llvm-svn: 269171
* [clang-tidy] Add modernize-make-shared checkPiotr Padlewski2016-05-021-0/+2
| | | | | | | | | Because modernize-make-shared do almost the same job as modernize-make-unique, I refactored common code to MakeSmartPtrCheck. http://reviews.llvm.org/D19183 llvm-svn: 268253
* clang-tidy: Add check modernize-raw-string-literalRichard Thomson2016-03-271-0/+3
| | | | llvm-svn: 264539
* [clang-tidy] introduce modernize-deprecated-headers checkAlexander Kornienko2016-02-241-0/+3
| | | | | | | | | | | | | | | | | Summary: This patch introduces the modernize-deprecated-headers check, which is supposed to replace deprecated C library headers with the C++ STL-ones. For information see documentation; for exmaples see the test cases. Reviewers: Eugene.Zelenko, LegalizeAdulthood, alexfh Subscribers: cfe-commits Patch by Kirill Bobyrev! Differential Revision: http://reviews.llvm.org/D17484 llvm-svn: 261738
* Only copy small types in modernize-loop-convert.Angel Garcia Gomez2015-10-301-0/+4
| | | | | | | | | | | | Summary: If the size of the type is above a certain bound, we'll take a const reference. This bound can be set as an option. For now, the default value is 16 bytes. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D14176 llvm-svn: 251694
* Add modernize-redundant-void-arg check to clang-tidyAlexander Kornienko2015-10-281-0/+3
| | | | | | | | | | | | | | | | | | | | | This check for clang-tidy looks for function with zero arguments declared as (void) and removes the unnecessary void token. int foo(void); becomes int foo(); The check performs no formatting of the surrounding context but uses the lexer to look for the token sequence "(", "void", ")" in the prototype text. If this sequence of tokens is found, a removal is issued for the void token only. Patch by Richard Thomson! (+fixed tests, moved the check to the modernize module) Differential revision: http://reviews.llvm.org/D7639 llvm-svn: 251475
* Add modernize-use-default check to clang-tidy.Angel Garcia Gomez2015-10-211-3/+4
| | | | | | | | | | | | | | | | | | | Summary: Add a check that replaces empty bodies of special member functions with '= default;'. For now, it is only implemented for the default constructor and the destructor, which are the easier cases. The copy-constructor and the copy-assignment operator cases will be implemented later. I applied this check to the llvm code base and found 627 warnings (385 in llvm, 9 in compiler-rt, 220 in clang and 13 in clang-tools-extra). Applying the fixes didn't break any build or test, it only caused a -Wpedantic warning in lib/Target/Mips/MipsOptionRecord.h:33 becaused it replaced virtual ~MipsOptionRecord(){}; to virtual ~MipsOptionRecord()= default;; Reviewers: klimek Subscribers: george.burgess.iv, Eugene.Zelenko, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13871 llvm-svn: 250897
* Create modernize-make-unique check.Angel Garcia Gomez2015-09-291-0/+3
| | | | | | | | | | | | Summary: create a check that replaces 'std::unique_ptr<type>(new type(args...))' with 'std::make_unique<type>(args...)'. It was on the list of "Ideas for new Tools". It needs to be tested more carefully, but first I wanted to know if you think it is worth the effort. Reviewers: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13166 llvm-svn: 248785
* Add NamingStyle option to modernize-loop-convert.Angel Garcia Gomez2015-09-241-0/+1
| | | | | | | | | | | | Summary: Add an option to specify wich style must be followed when choosing the new index name. Reviewers: alexfh Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D13052 llvm-svn: 248517
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-311-0/+4
| | | | | | | | | "modernize/" These checks are focusing on migrating the code from C++98/03 to C++11, so they belong to the modernize module. llvm-svn: 246437
* Add replace-auto_ptr check.Angel Garcia Gomez2015-08-251-0/+4
| | | | | | | | | | | | Summary: Migrate replace-auto_ptr check from clang-modernize to modernize module in clang-tidy. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D12287 llvm-svn: 245933
* [clang-tidy] Migrate UseAuto from clang-modernize to clang-tidy.Angel Garcia Gomez2015-08-211-0/+2
| | | | | | http://reviews.llvm.org/D12231 llvm-svn: 245703
* [clang-tidy] Add modernize-use-nullptr check, attempt 2.Alexander Kornienko2015-08-191-0/+5
| | | | | | | | | | | This patch re-applies r245434 and r245471 reverted in r245493, and changes the way custom null macros are configured. The test for custom null macros is temporarily excluded and will be committed separately to reduce chances of breakages. Initial patches by Angel Garcia. llvm-svn: 245511
* Revert "[clang-tidy] Add use-nullptr check to clang-tidy."Justin Bogner2015-08-191-5/+0
| | | | | | | | | | The new test is failing on darwin: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10339/ This reverts r245434 and its follow up r245471. llvm-svn: 245493
* [clang-tidy] Add use-nullptr check to clang-tidy.Alexander Kornienko2015-08-191-0/+5
| | | | | | | | | | Move UseNullptr from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12081 Patch by Angel Garcia! llvm-svn: 245434
* [clang-tidy] Add loop-convert check to clang-tidy.Alexander Kornienko2015-08-191-0/+3
| | | | | | | | | | Move LoopConvert from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12076 Patch by Angel Garcia! llvm-svn: 245427
* [clang-tidy] Create clang-tidy module modernize. Add pass-by-value check.Alexander Kornienko2015-08-141-0/+46
This is the first step for migrating cppmodernize to clang-tidy. http://reviews.llvm.org/D11946 Patch by Angel Garcia! llvm-svn: 245045
OpenPOWER on IntegriCloud