summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Add modernize-use-default-member-init checkMalcolm Parsons2016-12-204-0/+290
| | | | | | | | | | | | 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] Remove duplicated check from move-constructor-initMalcolm Parsons2016-12-176-95/+11
| | | | | | | | | | | | | | | | | | | | 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-tidy] fix missing anchor for MPI ModulePiotr Padlewski2016-12-161-0/+5
| | | | | | | | | | | | Summary: MPIModule was not linked to plugins Reviewers: alexfh, Alexander_Droste, hokein Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27813 llvm-svn: 289930
* [clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loopFelix Berger2016-12-161-0/+13
| | | | | | | | | | | | Summary: This fixes a bug where the performance-unnecessary-value-param check suggests a fix to move the parameter inside of a loop which could be invoked multiple times. Reviewers: sbenza, aaron.ballman, alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27187 llvm-svn: 289912
* [clang-tidy] Enhance modernize-use-auto to templated function castsMalcolm Parsons2016-12-151-4/+46
| | | | | | | | | | | | | | | | Summary: Use auto when declaring variables that are initialized by calling a templated function that returns its explicit first argument. Fixes PR26763. Reviewers: aaron.ballman, alexfh, staronj, Prazek Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27166 llvm-svn: 289797
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-1416-25/+20
| | | | llvm-svn: 289656
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-2/+2
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* [clang-tidy] Suggest including <cmath> if necessary in ↵Justin Lebar2016-12-142-10/+50
| | | | | | | | | | | | type-promotion-in-math-fn-check. Reviewers: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27748 llvm-svn: 289637
* [ClangTidy] Add new performance-type-promotion-in-math-fn check.Justin Lebar2016-12-144-2/+217
| | | | | | | | | | | | | Summary: This checks for calls to double-precision math.h with single-precision arguments. For example, it suggests replacing ::sin(0.f) with ::sinf(0.f). Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D27284 llvm-svn: 289627
* Remove trailing whitespace in docs and clang-tidy sources.Alexander Kornienko2016-12-132-2/+2
| | | | llvm-svn: 289547
* [Clang-tidy] check for malloc, realloc and free callsAlexander Kornienko2016-12-134-0/+109
| | | | | | | | | | | | | | | | | | | | | | | Summary: This checker flags the use of C-style memory management functionality and notes about modern alternatives. In an earlier revision it tried to autofix some kind of patterns, but that was a bad idea. Since memory management can be so widespread in a program, manual updating is most likely necessary. Maybe for special cases, there could be later additions to this basic checker. This is the first checker I wrote and I never did something with clang (only compiling programs). So whenever I missed conventions or did plain retarded stuff, feel free to point it out! I am willing to fix them and write a better checker. I hope the patch does work, I never did this either. On a testapply in my repository it did, but I am pretty unconfident in my patching skills :) Reviewers: aaron.ballman, hokein, alexfh, malcolm.parsons Subscribers: cfe-commits, JDevlieghere, nemanjai, Eugene.Zelenko, Prazek, mgorny, modocache Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26167 Patch by Jonas Toth! llvm-svn: 289546
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-138-26/+26
| | | | llvm-svn: 289542
* [clang-tidy] Add check for redundant function pointer dereferencesMalcolm Parsons2016-12-134-0/+76
| | | | | | | | | | Reviewers: alexfh, aaron.ballman, hokein Subscribers: mgorny, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27520 llvm-svn: 289524
* [clang-tidy] Do not trigger unnecessary-value-param check on methods marked ↵Felix Berger2016-12-021-1/+2
| | | | | | | | | | | | | | | | | as final Summary: Virtual method overrides of dependent types cannot be recognized unless they are marked as override or final. Exclude methods marked as final from check and add test. Reviewers: sbenza, hokein, alexfh Subscribers: malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27248 llvm-svn: 288502
* [clang-tidy] Rename modernize-use-default to modernize-use-equals-defaultMalcolm Parsons2016-12-015-15/+20
| | | | | | | | | | Reviewers: angelgarcia, aaron.ballman, alexfh Subscribers: JDevlieghere, Prazek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D26511 llvm-svn: 288375
* [clang-tidy] Make format style customizableJonas Devlieghere2016-11-303-12/+21
| | | | | | | | | | | | | | Summary: I came across an outstanding FIXME to make the format style customizable. Inspired by the include fixer, I added an new option `-style` to configure the fallback style in case no clang-format configuration file is found. The default remains "llvm". Reviewers: Prazek, aaron.ballman, hokein, alexfh Subscribers: cfe-commits, malcolm.parsons Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D27142 llvm-svn: 288258
* 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
* readability-redundant-declaration: Fix crashDaniel Marjamaki2016-11-211-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D26911 llvm-svn: 287540
* [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] Fix identifier naming for initializer list member initializers.Eric Fiselier2016-11-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds handling for member initializers in a constructors initializer list. Previously we only handled base-class and delegating initializers, which are transformed by the `TypeLoc` matcher. For Example: ``` // Style options: All identifiers should start with an upper case letter. struct base { ... }; struct der : base { int field; // FIXES: int Field; der() : der(42) {} // FIXES: Der() : Der(42) {} der(int X) : base(), field(X) {} // FIXES: Der(int X) : Base(), field(X) // Note that `field` doesn't get replaced }; ``` Reviewers: alexfh, hokein, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26744 llvm-svn: 287153
* [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] Change readability-redundant-member-init to get base type from ↵Malcolm Parsons2016-11-151-1/+1
| | | | | | | | | | | | | | constructor Summary: Fixes PR30835 Reviewers: alexfh, hokein, aaron.ballman Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D26118 llvm-svn: 286990
* [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-tidy] Do not issue fix for functions that are referenced outside of ↵Felix Berger2016-11-101-3/+15
| | | | | | | | | | | | | | | | | | | callExpr Summary: Suppress fixes for functions that are referenced within the compilation unit outside of a call expression as the signature change could break the code referencing the function. We still issue a warning in this case so that users can decide to manually change the function signature. Reviewers: alexfh, sbenza, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26203 llvm-svn: 286424
* [clang-tidy] Improve rename_check.py.Kirill Bobyrev2016-11-081-23/+38
| | | | | | | | | | | | -Start using argparse instead of mimicking CLI parsing. -PEPify the code. -Decrease the number of imports by slightly cleaning up the script. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D25074 llvm-svn: 286228
* [clang-tidy] clang-analyzer-alpha* checks are not registered, so there's no ↵Alexander Kornienko2016-11-081-3/+2
| | | | | | need to disable them llvm-svn: 286222
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-08102-375/+333
| | | | | | | | | | | | | | | | 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
* Use AnalyzerOptions::getRegisteredCheckers() instead of ↵Alexander Kornienko2016-11-082-43/+30
| | | | | | | | | | | | | | clang/StaticAnalyzer/Checkers/Checkers.inc Summary: Depends on D26310. Reviewers: zaks.anna, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26311 llvm-svn: 286219
* [clang-tidy] Simplify matchersAlexander Kornienko2016-11-081-36/+11
| | | | llvm-svn: 286213
* [clang-tidy] Don't warn implicit variables in ↵Haojian Wu2016-11-081-0/+1
| | | | | | | | | | | | | | | | | | | peformance-unnecessary-copy-initialization. Summary: This will prevent the check warning the variables which have been implicitly added by compiler, like the following case (in for-range loop): the variable '__end' is copy-constructed from a const reference... Reviewers: alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25911 llvm-svn: 286186
* [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
* [ClangTidy - performance-unnecessary-value-param] Only add "const" when ↵Felix Berger2016-11-041-1/+4
| | | | | | | | | | | | current parameter is not already const qualified Reviewers: alexfh, sbenza, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26207 llvm-svn: 286010
* [clang-tidy] Ignore incomplete types when determining whether they are ↵Felix Berger2016-11-041-1/+1
| | | | | | | | | | | | | | | | expensive to copy Summary: IsExpensiveToCopy can return false positives for incomplete types, so ignore them. All existing ClangTidy tests that depend on this function still pass as the types are complete. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26195 llvm-svn: 286008
* [clang-tidy] Fixed readability-else-after-return for cascade statementsMalcolm Parsons2016-11-041-1/+1
| | | | | | | | | | | | | | | | | | Summary: Fix generated by this check changed program semantics in the case where 'if' was a part (direct child) of other statement. Fixes PR30652. Patch by Paweł Żukowski. Reviewers: malcolm.parsons, alexfh, djasper Subscribers: mgehre, omtcyfz, cfe-commits Differential Revision: https://reviews.llvm.org/D26125 llvm-svn: 285999
* [clang-tidy] Ignore forward declarations without definitions in the same ↵Jonathan Coe2016-11-031-0/+3
| | | | | | | | | | | | | | translation unit in readability-identifier-naming Summary: This change ensures that forward declarations of classes are not considered for identifier naming checks within a translation unit. Reviewers: alexfh, aaron.ballman Subscribers: mgehre Differential Revision: https://reviews.llvm.org/D22571 llvm-svn: 285907
* [clang-tidy] Handle data() in readability-redundant-string-cstrMalcolm Parsons2016-11-031-3/+5
| | | | | | | | | | | | | | | Summary: std::string::data() and std::string::c_str() are equivalent. Enhance the readability-redundant-string-cstr check to also handle calls to data(). Reviewers: etienneb, alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26279 llvm-svn: 285901
* [clang-tidy] Suppress notes for warnings that were ignoredMalcolm Parsons2016-11-022-1/+9
| | | | | | | | Fixes PR30565. Patch by Nikita Kakuev llvm-svn: 285861
* [clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr.Martin Bohme2016-11-021-17/+55
| | | | | | | | | | | | | | Summary: As a unique_ptr or shared_ptr that has been moved from is guaranteed to be null, we only warn if the pointer is dereferenced. Reviewers: hokein, alexfh, aaron.ballman Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D26041 llvm-svn: 285842
* 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] Handle bitfields in cppcoreguidelines-pro-type-member-initMalcolm Parsons2016-11-011-2/+4
| | | | | | | | | | | | | | Summary: Unnamed bitfields cannot be initialized. Bitfields cannot be in-class initialized. Reviewers: alexfh, hokein, aaron.ballman Subscribers: Prazek, nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D26119 llvm-svn: 285752
* [Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by ↵Eugene Zelenko2016-11-011-2/+15
| | | | | | | | | | PVS-Studio Also fix some Include What You Use and modernize-use-bool-literals warnings. Differential revision: https://reviews.llvm.org/D26176 llvm-svn: 285721
* [clang-tidy] Add check readability-redundant-declarationDaniel Marjamaki2016-11-014-0/+110
| | | | | | | | | | | Finds redundant variable and function declarations. extern int X; extern int X; // <- redundant Differential Revision: https://reviews.llvm.org/D24656 llvm-svn: 285689
* [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] 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
* [clang-tidy] Fix identifier naming in macro args.Jason Henline2016-10-241-7/+37
| | | | | | | | | | | | | | | | | | | | | | Summary: clang-tidy should fix identifier naming even when the identifier is referenced inside a macro expansion, provided that the identifier enters the macro expansion completely within a macro argument. For example, this will allow fixes to the naming of the identifier 'global' when it is declared and used as follows: int global; #define USE_IN_MACRO(m) auto use_##m = m USE_IN_MACRO(global); Reviewers: alexfh Subscribers: jlebar, cfe-commits Differential Revision: https://reviews.llvm.org/D25450 llvm-svn: 284992
* Remove 'misc-pointer-and-integral-operation' clang-tidy check. The only casesRichard Smith2016-10-214-143/+0
| | | | | | | it detects are ill-formed (some per C++ core issue 1512, others always have been). llvm-svn: 284888
* [clang-tidy] Don't use a SmallSetVector of an enum.Justin Lebar2016-10-212-5/+10
| | | | | | | | | | | | | | | Summary: This doesn't work after converting SmallSetVector to use DenseSet. Instead we can just use a SmallVector. Reviewers: timshen Subscribers: nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D25647 llvm-svn: 284873
OpenPOWER on IntegriCloud