summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Silence -Wlogical-op-parentheses warning NFCNirav Dave2017-04-141-1/+1
| | | | llvm-svn: 300324
* [clang-tidy] Fixes to misc-forwarding-reference-overload check.Gabor Horvath2017-04-141-2/+3
| | | | | | | | | * Style fixes to tests * Make it work consistently on all platforms Patch by András Leitereg! llvm-svn: 300320
* Fix clang-tidy shared link with libc++Eric Fiselier2017-04-121-0/+1
| | | | | | | | | | | | | Currently the ClangTidyMain.cpp fails to link against shared LLVM/Clang libraries due to the missing symbol: clang::tooling::operator<(clang::tooling::Replacement const&, clang::tooling::Replacement const&); This patch fixes the issue by correctly linking clangToolingCore which contains the definition. llvm-svn: 300115
* [clang-tidy] Reuse FileID in getLocationChih-Hung Hsieh2017-04-061-1/+1
| | | | | | | | | | | | One FileID per warning will increase and overflow NextLocalOffset when input file is large with many warnings. Reusing FileID avoids this problem. This requires changes in getColumnNumber, D31406, rL299681. Differential Revision: http://reviews.llvm.org/D31406 llvm-svn: 299700
* [clang-tidy] Update docs and help messageAlexander Kornienko2017-04-061-1/+4
| | | | llvm-svn: 299651
* [clang-tidy] Add FormatStyle configuration option.Alexander Kornienko2017-04-066-34/+48
| | | | llvm-svn: 299649
* [clang-tidy] Check for forwarding reference overload in constructors.Gabor Horvath2017-04-064-0/+191
| | | | | | | | Patch by András Leitereg! Differential Revision: https://reviews.llvm.org/D30547 llvm-svn: 299638
* Fixes for modernize-use-using check:Krystyna Gajczyk2017-04-022-6/+25
| | | | | | | | | | | - removed unnessacary namespaces - added option to print warning in macros - no fix for typedef with array - removed "void" word from functions with 0 parameters Differential Revision: https://reviews.llvm.org/D29262 llvm-svn: 299340
* [clang-tidy] Revert D31406 (Reuse FileID in getLocation)Chih-Hung Hsieh2017-03-311-1/+1
| | | | | | | | | Somehow the change failed test clang-tidy/llvm-include-order.cpp on Windows platform. Differential Revision: http://reviews.llvm.org/D31406 llvm-svn: 299146
* [clang-tidy] Reuse FileID in getLocationChih-Hung Hsieh2017-03-301-1/+1
| | | | | | | | | | One FileID per warning will increase and overflow NextLocalOffset when input file is large with many warnings. Reusing FileID avoids this problem. Differential Revision: http://reviews.llvm.org/D31406 llvm-svn: 299119
* Spelling mistakes in comments. NFCI.Simon Pilgrim2017-03-302-4/+4
| | | | | | Based on corrections mentioned in patch for clang for PR27635 llvm-svn: 299074
* [clang-tidy] fix for linker errors in hicpp checksJonathan Coe2017-03-301-0/+5
| | | | | | Speculative fix for linker errors in r299068. llvm-svn: 299070
* [clang-tidy] add aliases for hicpp moduleJonathan Coe2017-03-301-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add some hicpp checks that can be implmented as alises for existing clang-tidy checks: hicpp-explicit-conversions hicpp-function-size hicpp-named-parameter hicpp-invalid-access-moved hicpp-member-init hicpp-new-delete-operators hicpp-noexcept-move hicpp-special-member-functions hicpp-undelegated-constructor hicpp-use-equals-default hicpp-use-equals-delete hicpp-use-override Reviewers: dberlin, jbcoe, aaron.ballman, alexfh Reviewed By: aaron.ballman Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D30383 Patch By: Jonas Toth llvm-svn: 299068
* [clang-tidy] Fix treating non-space whitespaces in checks list.Marek Kurdej2017-03-231-618/+619
| | | | | | | | | | | | | | | | Summary: This furtherly improves r295303: [clang-tidy] Ignore spaces between globs in the Checks option. Trims all whitespaces and not only spaces and correctly computes the offset of the checks list (taking the size before trimming). Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D30567 llvm-svn: 298621
* [clang-tidy] Don't use groups in the big regexy filterAlexander Kornienko2017-03-231-1/+1
| | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=27641. llvm-svn: 298619
* [clang-tidy] Fix diag message for catch-by-valueAlexander Kornienko2017-03-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: ``` catch (std::exception ex) { } ``` Was flagged with "catch handler catches a pointer value". Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits, JDevlieghere Patch by Florian Gross! Differential Revision: https://reviews.llvm.org/D30592 llvm-svn: 298608
* [clang-tidy] Catch trivially true statements like a != 1 || a != 3Alexander Kornienko2017-03-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | Catch trivially true statements of the form a != 1 || a != 3. Statements like these are likely errors. They are particularly easy to miss when handling enums: enum State { RUNNING, STOPPED, STARTING, ENDING } ... if (state != RUNNING || state != STARTING) ... Patch by Blaise Watson! Differential revision: https://reviews.llvm.org/D29858 llvm-svn: 298607
* [clang-tidy] clang-format the last patch. NFCAlexander Kornienko2017-03-222-24/+15
| | | | llvm-svn: 298500
* [clang-tidy] modified identifier naming case to use CT_AnyCase for ignoring ↵Alexander Kornienko2017-03-222-82/+103
| | | | | | | | | | | | | | | | | | | | | case style Summary: Using CaseType::CT_AnyCase for selected identifier results in inheriting case style setting from more basic identifier type. This patch changes CT_AnyCase behavior to ignore case style of specified identifier. If case style was not set, llvm::Optional will be used for keeping this information (llvm::Optional<>::hasVal), thus CT_AnyCase will no longer mean more general identifier style should be used. This eliminates false-positives when naming convention is not clear for specific areas of code (legacy, third party) or for selected types. Reviewers: berenm, alexfh Reviewed By: alexfh Subscribers: cfe-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D30931 llvm-svn: 298499
* Reverting r298421 due to using a header that's unavailable to all systems ↵Aaron Ballman2017-03-221-23/+4
| | | | | | and some other post-commit review feedback. llvm-svn: 298470
* Apply clang-tidy's performance-unnecessary-value-param to clang-tidy.Benjamin Kramer2017-03-214-6/+6
| | | | | | No functionality change intended. llvm-svn: 298442
* Don't make unqualified calls to functions that could well be found viaChandler Carruth2017-03-211-2/+2
| | | | | | | | | | | | | | | ADL as reasonable extension points. All of this would be cleaner if this code followed the more usual LLVM convention of not having deeply nested namespaces inside of .cpp files and instead having a `using namespace ...;` at the top. Then the static function would be in the global namespace and easily referred to as `::join`. Instead we have to write a fairly contrived qualified name. I figure the authors can clean this up with a less ambiguous name, using the newly provided LLVM `join` function, or any other solution, but this at least fixes the build. llvm-svn: 298434
* Prevent cppcoreguidelines-pro-bounds-array-to-pointer-decay from diagnosing ↵Aaron Ballman2017-03-211-4/+23
| | | | | | | | array to pointer decay stemming from system macros. Patch by Breno Rodrigues Guimaraes. llvm-svn: 298421
* [clang-tidy] readability-container-size-empty fix for (*x).size()Alexander Kornienko2017-03-201-3/+2
| | | | llvm-svn: 298316
* [clang-tidy] Small cleanup. NFC.Alexander Kornienko2017-03-201-10/+4
| | | | llvm-svn: 298315
* Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ ↵Aaron Ballman2017-03-198-29/+41
| | | | | | | | coding standard from PRQA. This commit renames all of the safety functionality to be hicpp, adds an appropriate LICENSE.TXT, and updates the documentation accordingly. llvm-svn: 298229
* [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on ↵Alexander Kornienko2017-03-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | defaulted declarations Summary: There is no need for triggering warning when noexcept specifier in move constructor or move-assignment operator is neither evaluated nor uninstantiated. This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712 Reviewers: alexfh Reviewed By: alexfh Subscribers: JonasToth, JDevlieghere, cfe-commits Tags: #clang-tools-extra Patch by Marek Jenda! Differential Revision: https://reviews.llvm.org/D31049 llvm-svn: 298101
* [clang-tidy] readability-misleading-indentation: fix chained ifAlexander Kornienko2017-03-172-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fixed erroneously flagging of chained if statements when styled like this: ``` if (cond) { } else if (cond) { } else { } ``` Reviewers: xazax.hun, alexfh Reviewed By: xazax.hun, alexfh Subscribers: JDevlieghere, cfe-commits Patch by Florian Gross! Differential Revision: https://reviews.llvm.org/D30841 llvm-svn: 298059
* [clang-tidy] Verify some conditions in a matcher instead of check(). NFCAlexander Kornienko2017-03-171-6/+7
| | | | llvm-svn: 298057
* [clang-tidy] Ignore deleted members in google-explicit-constructor.Alexander Kornienko2017-03-171-1/+1
| | | | | | This fixes http://llvm.org/PR32221. llvm-svn: 298052
* Add the 'AllowSoleDefaultDtor' and 'AllowMissingMoveFunctions' options to ↵Aaron Ballman2017-03-132-31/+92
| | | | | | | | the cppcoreguidelines-special-member-functions check. Patch by Florian Gross. llvm-svn: 297671
* [clang-tidy] readability-function-size: remove default param count thresholdAlexander Kornienko2017-03-081-1/+1
| | | | llvm-svn: 297311
* [clang-tidy] misc-use-after-move: Fix failing assertionMartin Bohme2017-03-081-1/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: I've added a test case that (without the fix) triggers the assertion, which happens when a move happens in an implicitly called conversion operator. This patch also fixes nondeterministic behavior in the source code location reported for the move when the move is constained in an init list; this was causing buildbot failures in the previous attempt to submit this patch (see D30569 and rL297004). Reviewers: alexfh Reviewed By: alexfh Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30650 llvm-svn: 297272
* [clang-tidy] Ignore substituted template types in modernize-use-nullptr check.Haojian Wu2017-03-061-0/+1
| | | | | | | | | | | | Reviewers: alexfh Reviewed By: alexfh Subscribers: xazax.hun, malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30639 llvm-svn: 297009
* Revert "[clang-tidy] misc-use-after-move: Fix failing assertion"Martin Bohme2017-03-061-1/+1
| | | | | | This reverts commit r297004; it was causing buildbots to fail. llvm-svn: 297006
* [clang-tidy] misc-use-after-move: Fix failing assertionMartin Bohme2017-03-061-1/+1
| | | | | | | | | | | | | | | | | Summary: I've added a test case that (without the fix) triggers the assertion, which happens when a move happens in an implicitly called conversion operator. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30569 llvm-svn: 297004
* [clang-tidy] Format code around applied fixesAlexander Kornienko2017-03-032-13/+29
| | | | | | | | | | | | | | | | Summary: Add -format option (disabled by default for now) to trigger formatting of replacements. Reviewers: ioeric Reviewed By: ioeric Subscribers: kimgr, malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30564 llvm-svn: 296864
* [clang-tidy] google-readability-casting: don't use constructor call syntax ↵Alexander Kornienko2017-03-031-1/+1
| | | | | | for const types llvm-svn: 296858
* [clang-tidy] google-readability-casting: detect redundant casts with ↵Alexander Kornienko2017-03-021-6/+6
| | | | | | top-level const llvm-svn: 296755
* [clang-tidy] Fix a few more issues in google-readability-castingAlexander Kornienko2017-03-021-34/+31
| | | | | | | | | * suggest static_cast instead of reinterpret_cast for casts from void* * top-level const doesn't need a const_cast * don't emit a separate "possibly redundant cast" warning, instead suggest static_cast (in C++ only) and add a little hint to consider removing the cast llvm-svn: 296753
* [clang-tidy] Function names configurable for cppcoreguidelines-nomalloc - ↵Alexander Kornienko2017-03-022-9/+47
| | | | | | | | | | | | | | | | | | | | | | | | checker Summary: Hello everybody, this is an incremental patch for the NoMalloc-Checker I wrote. It allows to configure the memory-management functions, that are checked, This might be helpful for a code base with custom functions in use, or non-standard functionality, like posix_memalign. Reviewers: aaron.ballman, hokein, alexfh Reviewed By: aaron.ballman, alexfh Subscribers: sbenza, nemanjai, JDevlieghere Tags: #clang-tools-extra Patch by Jonas Toth! Differential Revision: https://reviews.llvm.org/D28239 llvm-svn: 296734
* [clang-tidy] Add parametercount for readibility-function-sizeAlexander Kornienko2017-03-012-2/+16
| | | | | | | | | | | | | | | | | | | Summary: Add an option to function-size to warn about high parameter counts. This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well. Reviewers: sbenza, alexfh, hokein Reviewed By: alexfh, hokein Subscribers: JDevlieghere Patch by Jonas Toth! Differential Revision: https://reviews.llvm.org/D29561 llvm-svn: 296599
* [clang-tidy] Fix handling of methods with try-statement as a body in ↵Alexander Kornienko2017-03-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | modernize-use-override Summary: Fix generated by modernize-use-override caused syntax error when method used try-statement as a body. `override` keyword was inserted after last declaration token which happened to be a `try` keyword. This fixes PR27119. Reviewers: ehsan, djasper, alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Tags: #clang-tools-extra Patch by Paweł Żukowski! Differential Revision: https://reviews.llvm.org/D30002 llvm-svn: 296598
* [clang-tidy] Fix a false positive on modernize-use-nullptr check.Haojian Wu2017-02-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The false positive happens on two neighbour CXXDefaultArgExpr AST nodes. like below: ``` CXXFunctionalCastExpr 0x85c9670 <col:7, col:23> 'struct ZZ' functional cast to struct ZZ <ConstructorConversion> `-CXXConstructExpr 0x85c9518 <col:7, col:23> 'struct ZZ' 'void (uint64, const uint64 *)' |-CallExpr 0x85a0a90 <col:10, col:22> 'uint64':'unsigned long long' | |-ImplicitCastExpr 0x85a0a78 <col:10> 'uint64 (*)(uint64)' <FunctionToPointerDecay> | | `-DeclRefExpr 0x85a09f0 <col:10> 'uint64 (uint64)' lvalue Function 0x85a06a0 'Hash' 'uint64 (uint64)' | `-CXXDefaultArgExpr 0x85a0ac8 <<invalid sloc>> 'uint64':'unsigned long long' `-CXXDefaultArgExpr 0x85c94f8 <<invalid sloc>> 'const uint64 *' ``` For each particular CXXDefaultArgExpr node, we need to reset FirstSubExpr, otherwise FirstSubExpr will refer to an incorrect expr. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30412 llvm-svn: 296479
* [clang-tidy] Fix readability-redundant-declaration false positiveDaniel Marjamaki2017-02-241-8/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D27048 llvm-svn: 296100
* [clang-tidy] Reword the "code outside header guard" warning.Benjamin Kramer2017-02-211-6/+6
| | | | | | | | | | | | The check doesn't really know if the code it is warning about came before or after the header guard, so phrase it more neutral instead of complaining about code before the header guard. The location for the warning is still not optimal, but I don't think fixing that is worth the effort, the preprocessor doesn't give us a better location. Differential Revision: https://reviews.llvm.org/D30191 llvm-svn: 295715
* [clang-tidy] google-readability-casting: Handle user-defined conversionsAlexander Kornienko2017-02-181-52/+79
| | | | llvm-svn: 295544
* [clang-tidy] Add -path option to clang-tidy-diff.pyEhsan Akhgari2017-02-171-0/+4
| | | | | | | | | | | | | | | Summary: This flag allows specifying a custom path for the compilation database. Unfortunately we can't use the -p flag like other clang-tidy tools because it's already taken. Reviewers: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29806 llvm-svn: 295482
* [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] Ignore spaces between globs in the Checks option.Alexander Kornienko2017-02-161-0/+1
| | | | llvm-svn: 295303
OpenPOWER on IntegriCloud