summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix clang-tidy crash when a single fix is applied on multiple files.Eric Liu2016-08-093-40/+53
| | | | | | | | | | | | | | | Summary: tooling::Replacements only holds replacements for a single file, so this patch makes Fix a map from file paths to tooling::Replacements so that it can be applied on multiple files. Reviewers: hokein, alexfh Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D23257 llvm-svn: 278101
* [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
* Reapply r276973 "Adjust Registry interface to not require plugins to export ↵John Brawn2016-08-052-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a registry" This differs from the previous version by being more careful about template instantiation/specialization in order to prevent errors when building with clang -Werror. Specifically: * begin is not defined in the template and is instead instantiated when Head is. I think the warning when we don't do that is wrong (PR28815) but for now at least do it this way to avoid the warning. * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY instead provide a template definition then do explicit instantiation. No compiler I've tried has problems with doing it the other way, but strictly speaking it's not permitted by the C++ standard so better safe than sorry. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 277806
* [clang-tidy] misc-argument-comment non-strict modeAlexander Kornienko2016-08-043-22/+56
| | | | | | | | | | | | | | | | | Summary: The misc-argument-comment check now ignores leading and trailing underscores and case. The new `StrictMode` local/global option can be used to switch back to strict checking. Add getLocalOrGlobal version for integral types, minor cleanups. Reviewers: hokein, aaron.ballman Subscribers: aaron.ballman, Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D23135 llvm-svn: 277729
* [clang-tidy] Inefficient string operationAlexander Kornienko2016-08-034-0/+131
| | | | | | | | Patch by Bittner Barni! Differential revision: https://reviews.llvm.org/D20196 llvm-svn: 277677
* [extra-tools] Fix extra tools build bot warnings due to incorrect docEtienne Bergeron2016-08-031-2/+2
| | | | | | | /home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/tools/clang/tools/extra/clang-tidy/mpi/TypeMismatchCheck.cpp:172:12: warning: parameter 'Complex' not found in the function declaration [-Wdocumentation] /home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/tools/clang/tools/extra/clang-tidy/mpi/TypeMismatchCheck.cpp:206:12: warning: parameter 'Complex' not fo llvm-svn: 277578
* [clang-tidy] Fix missing dependency to static analyzerEtienne Bergeron2016-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch is fixing the build bot broken for a missing dependency. The missing dependency is breaking "shared" build. ``` ./mpi/TypeMismatchCheck.cpp: #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h" ``` I'm not a fan of that fix. It's brining a strange dependency. Reviewers: alexfh Subscribers: llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23093 llvm-svn: 277539
* [clang-tidy] Fix segfault in cppcore-guidelines-special-member-functions checkJonathan Coe2016-08-022-21/+18
| | | | | | | | | | | | | | | | | | | | Summary: Use a set rather than a vector of defined special member functions so that multiple declarations of the same function are only counted once. Move some private static member functions into the cpp file. Run clang-format on header. Reviewers: ericLemanissier, Prazek, aaron.ballman Subscribers: Prazek, cfe-commits, nemanjai Projects: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D23008 llvm-svn: 277523
* [clang-tidy] MPITypeMismatchCheckAlexander Kornienko2016-08-028-0/+448
| | | | | | | | | | | | | | | | This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match. All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. Instructions on how to apply the check can be found at: https://github.com/0ax1/MPI-Checker/tree/master/examples Patch by Alexander Droste! Differential revision: https://reviews.llvm.org/D21962 llvm-svn: 277516
* [clang-tidy] Fix an unused-using-decl false positive about template arguments inHaojian Wu2016-08-021-3/+17
| | | | | | | | | | | | | | | | function call expression. Summary: The check doesn't mark the template argument as used when the template argument is a template. Reviewers: djasper, alexfh Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22803 llvm-svn: 277444
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-0124-28/+28
| | | | 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
* Changes related to new implementation of tooling::Replacements as class.Eric Liu2016-08-011-1/+8
| | | | | | | | | | | | Summary: See http://reviews.llvm.org/D21748 for details. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21749 llvm-svn: 277336
* [clang-tidy] add check cppcoreguidelines-special-member-functionsJonathan Coe2016-07-304-0/+238
| | | | | | | | | | | | | | | | | | | Summary: Check for classes that violate the rule of five and zero as specified in CppCoreGuidelines: "If a class defines or deletes a default operation then it should define or delete them all." https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-default-operation-define-or-delete-them-all. Reviewers: alexfh, sbenza, aaron.ballman Subscribers: Prazek, Eugene.Zelenko, cfe-commits, ericLemanissier, nemanjai Projects: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D22513 llvm-svn: 277262
* Sorting includes; NFC.Aaron Ballman2016-07-291-1/+1
| | | | llvm-svn: 277217
* [Typo police] s/proccess/process/, s/auxiliary/auxilliary/.Justin Lebar2016-07-291-5/+5
| | | | llvm-svn: 277113
* [clang-tidy] Fixes to modernize-use-emplacePiotr Padlewski2016-07-293-27/+58
| | | | | | | | Not everything is valid, but it should works for 99.8% cases https://reviews.llvm.org/D22208 llvm-svn: 277097
* Revert r276973 "Adjust Registry interface to not require plugins to export a ↵John Brawn2016-07-282-1/+3
| | | | | | | | | registry" Buildbot failures when building with clang -Werror. Reverting while I try to figure this out. llvm-svn: 277008
* Reapply r276856 "Adjust Registry interface to not require plugins to export ↵John Brawn2016-07-282-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | a registry" This version has two fixes compared to the original: * In Registry.h the template static members are instantiated before they are used, as clang gives an error if you do it the other way around. * The use of the Registry template in clang-tidy is updated in the same way as has been done everywhere else. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 276973
* Revert test commitMartin Bohme2016-07-261-1/+0
| | | | | | This reverts rL276746. llvm-svn: 276752
* Test commit -- adding a newlineMartin Bohme2016-07-261-0/+1
| | | | llvm-svn: 276746
* Revert "MPITypeMismatchCheck for Clang-Tidy"Alexander Kornienko2016-07-258-440/+0
| | | | | | This reverts commit r276640. Breaks multiple buildbots. llvm-svn: 276651
* MPITypeMismatchCheck for Clang-TidyAlexander Kornienko2016-07-258-0/+440
| | | | | | | | | | | | | | | | | | | | | | Summary: This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match. All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. Instructions on how to apply the check can be found at: https://github.com/0ax1/MPI-Checker/tree/master/examples Reviewers: alexfh Subscribers: cfe-commits Projects: #clang-tools-extra Patch by Alexander Droste! Differential Revision: https://reviews.llvm.org/D21962 llvm-svn: 276640
* Revert "Revert "[clang-tidy] new cppcoreguidelines-slicing""Clement Courbet2016-07-224-0/+184
| | | | | | Second try for r276408 llvm-svn: 276415
* Revert "[clang-tidy] new cppcoreguidelines-slicing"Clement Courbet2016-07-224-184/+0
| | | | | | Tests fail on clang-x64-ninja-win7 due to too narrow expectation. llvm-svn: 276413
* [clang-tidy] new cppcoreguidelines-slicingClement Courbet2016-07-224-0/+184
| | | | | | | | | | | | Flags slicing of member variables or vtable. See: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es63-dont-slice https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c145-access-polymorphic-objects-through-pointers-and-references Differential revision: http://reviews.llvm.org/D21974 llvm-svn: 276408
* [clang-tidy] Avoid duplicated DenseMap lookup.Benjamin Kramer2016-07-211-2/+1
| | | | | | | The std::string is still constructed on demand. No functionality change intended. llvm-svn: 276282
* 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] readability-identifier-naming - support for other case typesKirill Bobyrev2016-07-202-0/+31
| | | | | | | | | | | | | | | | | | | Added Camel_Snake_Case and camel_Snake_Back class Camel_Snake_Case_Class_Name { void private_Camel_Snake_Back_Method_Name(); } Patch by James Reynolds! Reviewers: alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21472 llvm-svn: 276110
* cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructorMatthias Gehre2016-07-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The code struct A { int x[3]; }; gets an compiler-generated copy constructor that uses ArraySubscriptExpr (see below). Previously, the check would generate a warning on that copy constructor. This commit disables the warning on implicitly generated code. AST: |-CXXConstructorDecl 0x337b3c8 <col:8> col:8 implicit used constexpr A 'void (const struct A &) noexcept' inline | |-ParmVarDecl 0x337b510 <col:8> col:8 used 'const struct A &' | |-CXXCtorInitializer Field 0x3379238 'x' 'int [3]' | | `-ImplicitCastExpr 0x337e158 <col:8> 'int' <LValueToRValue> | | `-ArraySubscriptExpr 0x337e130 <col:8> 'const int' lvalue | | |-ImplicitCastExpr 0x337e118 <col:8> 'const int *' <ArrayToPointerDecay> | | | `-MemberExpr 0x337dfc8 <col:8> 'int const[3]' lvalue .x 0x3379238 | | | `-DeclRefExpr 0x337dfa0 <col:8> 'const struct A' lvalue ParmVar 0x337b510 '' 'const struct A &' | | `-ImplicitCastExpr 0x337e098 <col:8> 'unsigned long' <LValueToRValue> | | `-DeclRefExpr 0x337e070 <col:8> 'unsigned long' lvalue Var 0x337e010 '__i0' 'unsigned long' Reviewers: alexfh, aaron.ballman Subscribers: aemerson, nemanjai, cfe-commits Differential Revision: https://reviews.llvm.org/D22381 llvm-svn: 275993
* Unbreak extra tools build post r275882.Benjamin Kramer2016-07-181-0/+1
| | | | llvm-svn: 275886
* cppcoreguidelines-pro-bounds-constant-array-index: crash for value dependent ↵Matthias Gehre2016-07-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | index in c++03 mode Summary: When the expression is value dependent, isIntegerConstantExpr() crashes in C++03 mode with ../tools/clang/lib/AST/ExprConstant.cpp:9330: (anonymous namespace)::ICEDiag CheckICE(const clang::Expr *, const clang::ASTContext &): Assertion `!E->isValueDependent() && "Should not see value dependent exprs!"' failed. In C++11 mode, that assert does not trigger. This commit works around this in the check. We don't check value-dependent indices and instead check their specialization. Reviewers: alexfh, aaron.ballman Subscribers: nemanjai, cfe-commits Differential Revision: http://reviews.llvm.org/D22190 llvm-svn: 275461
* [clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully ↵Haojian Wu2016-07-131-2/+2
| | | | | | | | | | | | templated function. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22260 llvm-svn: 275263
* [clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions.Haojian Wu2016-07-112-11/+8
| | | | | | | | | | | | | | | Summary: Although there is no guarantee of getOptions/getRawOptions receiving an absolute path, we try to make it if possible. So FileOptionProvider subclasses don't have to convert the path to an absolute path. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22154 llvm-svn: 275051
* clang-tidy/readability-identifier-naming: crash on ↵Matthias Gehre2016-07-091-3/+4
| | | | | | | | | | | | | | | | DependentTemplateSpecializationType Summary: Previously, the added test cases crashed because the passed a null Decl to addUsage(). Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22188 llvm-svn: 274985
* [clang-tidy] Add dependency on clang-headersNico Weber2016-07-071-0/+3
| | | | | | | | | | | Currently, to be able to process a source file including e.g. stddef.h with clang-tidy, one has to build both clang-tidy and the clang-headers target. Since stddef.h is needed for virtually any source file, let clang-tidy depend on clang-headers, so that it Just Works after it has been built. http://reviews.llvm.org/D22046 llvm-svn: 274751
* [clang-tidy] Enhance redundant-expression checkEtienne Bergeron2016-07-072-0/+516
| | | | | | | | | | | | Summary: This patch is adding support to recognize more complex redundant expressions. Reviewers: alexfh Subscribers: aaron.ballman, cfe-commits, chrisha Differential Revision: http://reviews.llvm.org/D21392 llvm-svn: 274731
* [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methodsFelix Berger2016-07-051-2/+4
| | | | | | | | | | | | | | Summary: As changing virtual methods could break method overrides disable applying the fix and just warn. Reviewers: alexfh, sbenza Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21936 llvm-svn: 274552
* [clang-tidy] Fix more enum declaration cases in misc-unused-using-decls check.Haojian Wu2016-07-041-0/+3
| | | | | | | | | | | | Summary: Fix PR28350. Reviewers: alexfh Subscribers: aaron.ballman, Eugene.Zelenko, cfe-commits Differential Revision: http://reviews.llvm.org/D21833 llvm-svn: 274496
* [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const ↵Felix Berger2016-07-017-20/+178
| | | | | | | | | | | | | | | | | | | | value parameter can be moved. Summary: Make check more useful in the following two cases: The parameter is passed by non-const value, has a non-deleted move constructor and is only referenced once in the function as argument to the type's copy constructor. The parameter is passed by non-const value, has a non-deleted move assignment operator and is only referenced once in the function as argument of the the type's copy assignment operator. In this case suggest a fix to move the parameter which avoids the unnecessary copy and is closest to what the user might have intended. Reviewers: alexfh, sbenza Subscribers: cfe-commits, Prazek Differential Revision: http://reviews.llvm.org/D20277 llvm-svn: 274380
* [clang-tidy] Do not match on lambdas.Samuel Benzaquen2016-06-281-4/+8
| | | | | | | | We match on the generated FunctionDecl of the lambda and try to fix it. This causes a crash. The right behavior is to ignore lambdas, because they are a definition. llvm-svn: 274019
* [clang-tidy] boost-use-to-string arg expr location bugfixPiotr Padlewski2016-06-281-1/+1
| | | | | | | | | | | | Summary: getExprLoc returns location after dot for member call. Reviewers: alexfh, sbenza, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21642 llvm-svn: 274001
* [clang-tidy] Warning enum unused using declarations.Haojian Wu2016-06-271-3/+6
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D21747 llvm-svn: 273882
* [clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.Haojian Wu2016-06-271-0/+4
| | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21470 llvm-svn: 273849
* [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-242-6/+1
| | | | llvm-svn: 273660
* Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.Tim Shen2016-06-216-14/+20
| | | | | | | | | | | | 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-215-0/+147
| | | | | | | | | | 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] More doc fixes. NFC.Alexander Kornienko2016-06-173-30/+30
| | | | llvm-svn: 272995
* [clang-tidy] Fix doxygen errors. NFC.Alexander Kornienko2016-06-179-55/+68
| | | | llvm-svn: 272994
OpenPOWER on IntegriCloud