summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-132-15/+15
| | | | llvm-svn: 289542
* [clang-tidy] Rename modernize-use-default to modernize-use-equals-defaultMalcolm Parsons2016-12-014-14/+14
| | | | | | | | | | Reviewers: angelgarcia, aaron.ballman, alexfh Subscribers: JDevlieghere, Prazek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D26511 llvm-svn: 288375
* Fix some Clang-tidy modernize-use-default and Include What You Use warnings; ↵Eugene Zelenko2016-11-294-12/+56
| | | | | | | | other minor fixes (NFC). This preparation to remove SetVector.h dependency on SmallSet.h. llvm-svn: 288175
* [clang-tidy] Ignore template instantiations in modernize-use-equals-delete checkMalcolm Parsons2016-11-171-0/+1
| | | | | | | | | | | | Summary: Template instantiations were causing misplaced fixits. Reviewers: aaron.ballman, alexfh, hokein Subscribers: hokein, cfe-commits Differential Revision: https://reviews.llvm.org/D26751 llvm-svn: 287221
* [clang-tidy] Changes to modernize-use-default checkMalcolm Parsons2016-11-171-7/+18
| | | | | | | | | | | | | | | | | | Summary: Warn about special member functions that only contain a comment. Report the location of the special member function, unless it is defined in a macro. Reporting the location of the body in a macro is more helpful as it causes the macro expansion location to be reported too. Fixes PR30920. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26741 llvm-svn: 287215
* [clang-tidy] New check to prefer transparent functors to non-transparent ones.Gabor Horvath2016-11-164-0/+172
| | | | llvm-svn: 287107
* [clang-tidy] Handle template instantiations in modenize-use-default checkMalcolm Parsons2016-11-161-0/+1
| | | | | | | | | | | | | | | | Summary: Duplicate fixes were being created for explicit template instantiations of out-of-line constructors or destructors. Fixes PR30921. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26582 llvm-svn: 287091
* [clang-tidy] Add modernize-use-equals-delete checkMalcolm Parsons2016-11-104-0/+123
| | | | | | | | | | | | 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-087-20/+15
| | | | | | | | | | | | | | | | 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] Fix a regression issue introduced by r285239.Haojian Wu2016-11-071-0/+8
| | | | | | | | | | | | | | | Summary: r285239 changes the behavior of AST CXXDefaultArgExpr node. Update `modernize-use-nullptr` to handle CXXDefaultArgExpr correctly. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26301 llvm-svn: 286156
* [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()Malcolm Parsons2016-10-312-2/+59
| | | | | | | | | | | | | | | Summary: Avoid naked new in unique_ptr.reset() by using make_unique Fixes http://llvm.org/PR27383 Reviewers: alexfh, aaron.ballman Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D25898 llvm-svn: 285589
* [clang-tidy] Enhance modernize-use-auto to castsMalcolm Parsons2016-10-312-25/+56
| | | | | | | | | | | | | | | | | | | | Summary: Extend modernize-use-auto to cases when a variable is assigned with a cast. e.g. Type *Ptr1 = dynamic_cast<Type*>(Ptr2); http://llvm.org/PR25499 Reviewers: angelgarcia, aaron.ballman, klimek, Prazek, alexfh Subscribers: Prazek, Eugene.Zelenko, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D25316 llvm-svn: 285579
* Use auto in for loopMalcolm Parsons2016-10-201-1/+1
| | | | llvm-svn: 284737
* [clang-tidy] Simplify modernize-use-defaultMalcolm Parsons2016-10-201-42/+7
| | | | | | | | | | | | | | Summary: clang-tidy now cleans up after replacements, so leave colon and comma removal to that. Reviewers: angelgarcia, alexfh, aaron.ballman, djasper, ioeric Subscribers: djasper, cfe-commits Differential Revision: https://reviews.llvm.org/D25769 llvm-svn: 284735
* [Clang-tidy]: Fix modernize-avoid-bind erroneous scope resolution.Haojian Wu2016-10-201-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, i would like to suggest a fix for one of the checks in clang-tidy and i should hope this one is the correct mailing list. The check is modernize-avoid-bind. Consider the following: void bar(int x, int y); namespace N { void bar(int x, int y); } void foo(){ auto Test = std::bind(N::bar,1,1); } clang-tidy’s modernize-avoid-bind check suggests writing: void foo(){ auto Test =[] {return bar(1,1);}; } instead of: void foo(){ auto Test = [] {return N::bar(1,1);}; } So clang-tidy has proposed an incorrect Fix. Patch by IdrissRio! Reviewers: alexfh, hokein, aaron.ballman Subscriber: cfe-commits llvm-svn: 284719
* [clang-tidy] Fix readability-braces-around-statements false positiveMarek Kurdej2016-10-141-1/+2
| | | | | | | | | | | | | | | | | Summary: This fixes a false-positive e.g. when string literals are returned from if statement. This patch includes as well a small fix to includes and renames of the test suite that collided with the name of the check. Reviewers: alexfh, hokein Subscribers: hokein Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D25558 llvm-svn: 284212
* [clang-tidy] modernize-use-default default constructor bugfixMalcolm Parsons2016-10-111-7/+7
| | | | | | | | | | | | | | Summary: Only member initializers that are written should prevent using '= default' on a default constructor. Reviewers: klimek, sbenza, aaron.ballman, alexfh Subscribers: Eugene.Zelenko, alexfh, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24444 llvm-svn: 283869
* [clang-tidy] Cleaning up language options.Gabor Horvath2016-09-245-30/+26
| | | | | | Differential Revision: https://reviews.llvm.org/D24881 llvm-svn: 282319
* [clang-tidy] modernize-make-{smart_ptr} private ctor bugfixPiotr Padlewski2016-08-311-1/+7
| | | | | | | | | | | | | | | Summary: Bugfix for 27321. When the constructor of stored pointer type is private then it is invalid to change it to make_shared or make_unique. Reviewers: alexfh, aaron.ballman, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23343 llvm-svn: 280180
* Adapt to TraverseLambdaCapture interface change from D23204Martin Bohme2016-08-172-3/+5
| | | | | | | | | | | | | | | Summary: Depends on D23204. This is intended to be submitted immediately after D23204 lands. Reviewers: jdennett, alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23543 llvm-svn: 278934
* [clang-tidy] minor improvements in modernise-deprecated-headers checkKirill Bobyrev2016-08-101-15/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a minor list of changes as proposed by Richard Smith in the mailing list. See original comments with an impact on the future check state below: [comments.begin > + {"complex.h", "ccomplex"}, It'd be better to convert this one to <complex>, or leave it alone. <ccomplex> is an unnecessary wart. (The contents of C++11's <complex.h> / <ccomplex> / <complex> (all of which are identical) aren't comparable to C99's <complex.h>, so if this was C++98 code using the C99 header, the code will be broken with or without this transformation.) > + {"iso646.h", "ciso646"}, Just delete #includes of this one. <ciso646> does nothing. > + {"stdalign.h", "cstdalign"}, > + {"stdbool.h", "cstdbool"}, We should just delete these two includes. These headers do nothing in C++. comments.end] Reviewers: alexfh, aaron.ballman Differential Revision: https://reviews.llvm.org/D17990 llvm-svn: 278254
* [clang-tidy] enhance modernize-use-bool-literals to check ternary operatorKirill Bobyrev2016-08-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | modernize-use-bool-literals doesn't checks operands in ternary operator. For example: ``` c++ static int Value = 1; bool foo() { bool Result = Value == 1 ? 1 : 0; return Result; } bool boo() { return Value == 1 ? 1 : 0; } ``` This issue was reported in bug 28854. The patch fixes it. Reviewers: alexfh, aaron.ballman, Prazek Subscribers: Prazek, Eugene.Zelenko Differential Revision: https://reviews.llvm.org/D23243 llvm-svn: 278022
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-011-1/+1
| | | | llvm-svn: 277340
* [clang-tidy] Prepare modernize-loop-convert for upcoming changes in D22566Martin Bohme2016-08-011-0/+12
| | | | | | | | | | | | | | | Summary: D22566 will change RecursiveASTVisitor so that it descends into the initialization expressions for lambda captures. modernize-loop-convert needs to be prepared for this so that it does not interpret these initialization expressions as invalid uses of the loop variable. The change has no ill effects without D22566 in place, i.e. the change does not depend on D22566. Reviewers: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22903 llvm-svn: 277339
* [clang-tidy] Fixes to modernize-use-emplacePiotr Padlewski2016-07-292-25/+58
| | | | | | | | Not everything is valid, but it should works for 99.8% cases https://reviews.llvm.org/D22208 llvm-svn: 277097
* clang-tidy modernize-loop-convert: preserve type of alias declaration (bug ↵Matthias Gehre2016-07-201-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 28341) Summary: Previoly, the added test failed with the fillowing fixit: char v[5]; - for(size_t i = 0; i < 5; ++i) + for(char value : v) { - unsigned char value = v[i]; if (value > 127) i.e. the variable 'value' changes from unsigned char to signed char. And thus the following 'if' does not work anymore. With this commit, the fixit is changed to: char v[5]; - for(size_t i = 0; i < 5; ++i) + for(unsigned char value : v) { - unsigned char value = v[i]; if (value > 127) Reviewers: alexfh, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22069 llvm-svn: 276111
* [clang-tidy] Add modernize-use-usingKrystyna Gajczyk2016-06-254-0/+131
| | | | | | http://reviews.llvm.org/D18919 llvm-svn: 273786
* Remove ignoringImplicit from clang-tidy.Cong Liu2016-06-241-1/+1
| | | | llvm-svn: 273660
* Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.Tim Shen2016-06-213-3/+6
| | | | | | | | | | | | Summary: This is a fix for the new ExprWithCleanups introduced by clang's temporary variable lifetime marks change. Reviewers: bkramer, sbenza, angelgarcia, alexth Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D21243 llvm-svn: 273310
* [clang-tidy] Add modernize-use-emplacePiotr Padlewski2016-06-214-0/+145
| | | | | | | | | | 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] Fix doxygen errors. NFC.Alexander Kornienko2016-06-171-3/+8
| | | | llvm-svn: 272994
* [clang-tidy] Remove dead code. NFC.Benjamin Kramer2016-06-152-17/+0
| | | | llvm-svn: 272803
* [clang-tidy] modernize-use-auto: don't remove stars by defaultAlexander Kornienko2016-06-032-22/+36
| | | | | | | | | | | | | | | Summary: By default, modernize-use-auto check will retain stars when replacing an explicit type with `auto`: `MyType *t = new MyType;` will be changed to `auto *t = new MyType;`, thus resulting in more consistency with the recommendations to use `auto *` for iterating over pointers in range-based for loops: http://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto The new `RemoveStars` option allows to revert to the old behavior: with the new option turned on the check will change `MyType *t = new MyType;` to `auto t = new MyType;`. Reviewers: aaron.ballman, sbenza Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D20917 llvm-svn: 271739
* [ASTMatchers] Added ignoringParenImpCasts to has matchersPiotr Padlewski2016-05-315-46/+48
| | | | | | | | | 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] modernize-pass-by-value bugfixMads Ravn2016-05-241-0/+5
| | | | | | | | | | | | Modified the clang-tidy PassByValue check. It now stops adding std::move to type which is trivially copyable because that caused the clang-tidy MoveConstArg to complain and revert, thus creating a cycle. I have also added a lit-style test to verify the bugfix. This is the bug on bugzilla: https://llvm.org/bugs/show_bug.cgi?id=27731 This is the code review on phabricator: http://reviews.llvm.org/D20365 llvm-svn: 270565
* Commiting for http://reviews.llvm.org/D20365Mads Ravn2016-05-231-6/+0
| | | | llvm-svn: 270473
* Commiting for http://reviews.llvm.org/D20365Mads Ravn2016-05-231-0/+6
| | | | llvm-svn: 270472
* [clang-tidy] Lift common matchers to utils namespaceEtienne Bergeron2016-05-171-15/+2
| | | | | | | | | | | | | | Summary: This patch is lifting matchers used by more than one checkers to the common namespace. Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D19841 llvm-svn: 269804
* [clang-tidy] Adds modernize-avoid-bind checkJonathan Coe2016-05-124-0/+203
| | | | | | | | | | | | | | | 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-114-0/+94
| | | | | | Review link: http://reviews.llvm.org/D18745 llvm-svn: 269171
* [clang-tidy] Cleanup namespace in utils folder.Etienne Bergeron2016-05-034-12/+14
| | | | | | | | | | | | | | Summary: This is a step forward cleaning up the namespaces in clang-tidy/utils. There is no behavior change. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19819 llvm-svn: 268356
* [Clang-tidy] Fix Clang-tidy modernize-use-override and some Include What You ↵Eugene Zelenko2016-05-031-3/+5
| | | | | | Use warnings in modernize/MakeSmartPtrCheck.h. llvm-svn: 268349
* [clang-tidy] Cleaning namespaces to be more consistant across checkers.Etienne Bergeron2016-05-022-4/+2
| | | | | | | | | | | | | | 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
* [clang-tidy] Add modernize-make-shared checkPiotr Padlewski2016-05-028-139/+302
| | | | | | | | | 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
* small reformat to test accessPiotr Padlewski2016-04-291-27/+27
| | | | llvm-svn: 268076
* [clang-tidy] Cleanup some ast-matchers and lift some to utils.Etienne Bergeron2016-04-211-17/+2
| | | | | | | | | | | | | | | | Summary: Little cleanup to lift-out and to remove some frequently used ast-matchers. Some of theses matchers are candidates to be lifted to ASTMatchers.h. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19200 llvm-svn: 267003
* [Clang-tidy] Fix for crash in modernize-raw-string-literal checkAlexander Kornienko2016-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Clang-tidy modernize-raw-string-literal check crashes on run-time assert while it is evaluating compiler predefined identifiers such as - __FUNCTION__ - __func__ - __PRETTY_FUNCTION__ Check is asserting because it cannot find opening quote for such string literal. It occurs only on debug build config. I think that it would be good to prune such cases by crossing off predefined expressions - there is no need to evaluate such matches. Reviewers: LegalizeAdulthood, alexfh Subscribers: cfe-commits Patch by Marek Jenda! Differential Revision: http://reviews.llvm.org/D19331 llvm-svn: 266992
* Add support for type aliases to modernize-redundant-void-arg.cppAaron Ballman2016-04-142-11/+16
| | | | | | Patch by Clement Courbet. llvm-svn: 266358
* [clang-tidy] fix a couple of modernize-use-override bugsAlexander Kornienko2016-04-041-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix for __declspec attributes and const=0 without space This patch is to address 2 problems I found with Clang-tidy:modernize-use-override. 1: missing spaces on pure function decls. Orig: void pure() const=0 Problem: void pure() constoverride =0 Fixed: void pure() const override =0 2: This is ms-extension specific, but possibly applies to other attribute types. The override is placed before the attribute which doesn’t work well with declspec as this attribute can be inherited or placed before the method identifier. Orig: class __declspec(dllexport) X : public Y { void p(); }; Problem: class override __declspec(dllexport) class X : public Y { void p(); }; Fixed: class __declspec(dllexport) class X : public Y { void p() override; }; Patch by Robert Bolter! Differential Revision: http://reviews.llvm.org/D18396 llvm-svn: 265298
* clang-tidy: Add check modernize-raw-string-literalRichard Thomson2016-03-274-0/+189
| | | | llvm-svn: 264539
OpenPOWER on IntegriCloud