summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Disable most of the google-readability-casting check for non-C++ files (onlyAlexander Kornienko2014-09-211-0/+4
| | | | | | leave the "redundant cast to the same type" part). llvm-svn: 218225
* [clang-tidy] Don't leak the TodoCommentHandler objectHans Wennborg2014-09-182-6/+14
| | | | | | | | | | | Preprocessor:addCommentHandler() does not take ownership, so we'd end up leaking the TodoCommentHandler. This patch makes it owned by the Check object. Differential Revision: http://reviews.llvm.org/D5402 llvm-svn: 218068
* [clang-tidy] Add a checker that warns on TODO comments without username.Benjamin Kramer2014-09-184-0/+102
| | | | | | | | | It also suggests a fix-it, taking the name from $USER. This will be made configurable eventually. Differential Revision: http://reviews.llvm.org/D5393 llvm-svn: 218049
* Make a variable local so it's lifetime becomes more obvious.Benjamin Kramer2014-09-171-6/+7
| | | | | | NFC llvm-svn: 217952
* [clang-tidy] Don't emit the same fixit multiple times.Benjamin Kramer2014-09-171-5/+5
| | | | | | | | | | If we had many header files we would attach the fix-it for all files to all warnings, oops. This is harmless 99.9% of the time but can confuse the rewriter in some edge cases. Sadly I failed to create a small test case for this. While there move fix-its instead of copying. llvm-svn: 217951
* [clang-tidy] When emitting header guard fixes bundle all fix-its into oneBenjamin Kramer2014-09-161-17/+31
| | | | | | | | | warning. Before we would emit two warnings if the header guard was wrong and the comment on a trailing #endif also needed fixing. llvm-svn: 217890
* [clang-tidy] Add a checker for long functions.Benjamin Kramer2014-09-154-0/+153
| | | | | | | | | | | | | | | | As this is very dependent on the code base it has some ways of configuration. It's possible to pick between 3 modes of operation: - Line counting: number of lines including whitespace and comments - Statement counting: number of statements within compoundStmts. - Branch counter In addition a threshold can be picked, warnings are only emitted when it is met. The thresholds can be configured via a .clang-tidy file. Differential Revision: http://reviews.llvm.org/D4986 llvm-svn: 217768
* Implemented clang-tidy-check-specific options.Alexander Kornienko2014-09-1232-53/+256
| | | | | | | | | | | | | | | | | Summary: Each check can implement readOptions and storeOptions methods to read and store custom options. Each check's options are stored in a local namespace to avoid name collisions and provide some sort of context to the user. Reviewers: bkramer, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5296 llvm-svn: 217661
* Moved main() to the clang::tidy namespace, no functional changes.Alexander Kornienko2014-09-101-22/+24
| | | | llvm-svn: 217493
* std::function-ize ClangTidyCheckFactories.Alexander Kornienko2014-09-102-63/+46
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5289 llvm-svn: 217492
* Unique-ptrify ClangTidyCheckFactories. Add a more convenient alternative toAlexander Kornienko2014-09-105-76/+50
| | | | | | | | | | | | | | addCheckFactory: registerCheck. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5288 llvm-svn: 217489
* [clang-tidy] Don't try to fix header guard #endif comments if there are escapedBenjamin Kramer2014-09-101-0/+7
| | | | | | | | newlines involved. Getting that right is just not worth it. llvm-svn: 217480
* Unique_ptrify PPCallbacks ownership. Goes with clang r217474.Craig Topper2014-09-102-2/+4
| | | | llvm-svn: 217475
* run-clang-tidy: Make clang-tidy path configurable and don't fail as horriblyBenjamin Kramer2014-09-081-9/+23
| | | | | | when it's not around. llvm-svn: 217374
* [clang-tidy] Add a little python script that can run clang-tidy and apply ↵Benjamin Kramer2014-09-081-0/+175
| | | | | | | | | | | | | | | | fixes over an entire codebase. Ever wanted to fix all the header guards in clang? Now it's easy. Make sure clang-tidy is in $PATH and a compilation database is available. $ ./run-clang-tidy.py -checks=-*,llvm-header-guard -fix ... get coffee (or more CPU cores) ... $ svn diff Some may argue that this is just a glorified xargs -P, but it does a bit more ;) Differential Revision: http://reviews.llvm.org/D5188 llvm-svn: 217368
* Try to make VS 2012 happy after r217155Hans Wennborg2014-09-041-3/+4
| | | | | | | | | | | | | | | | It was failing with: C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\llvm\include\llvm/Support/ErrorOr.h(102) : error C3861: 'make_error_code': identifier not found C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang-tools-extra\clang-tidy\ClangTidyOptions.cpp(153) : see reference to function template instantiation 'llvm::ErrorOr<T>::ErrorOr<std::errc::errc>(E,void *)' being compiled with [ T=clang::tidy::ClangTidyOptions, E=std::errc::errc ] llvm-svn: 217201
* Don't write files with no fixes.Alexander Kornienko2014-09-041-1/+1
| | | | llvm-svn: 217163
* Implemented clang-tidy configurability via .clang-tidy files.Alexander Kornienko2014-09-047-44/+254
| | | | | | | | | | | | | | | | | Summary: This adds a support for the .clang-tidy file reading using FileOptionsProvider, -dump-config option, and changes tests to not depend on default checks set. Reviewers: klimek, bkramer, djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5186 llvm-svn: 217155
* [clang-tidy] Add an option to export suggested fixes into a file.Benjamin Kramer2014-09-043-0/+34
| | | | | | | | Allows gathering fixes and applying them with clang-apply-fixes. Differential Revision: http://reviews.llvm.org/D5176 llvm-svn: 217139
* ClangTidy misc-argument-comment check: don't check arguments to templateAlexander Kornienko2014-09-031-0/+9
| | | | | | | | | | | | | | | | | | | parameter packs. Summary: This disables this check for std::bind and similar functions that use parameter packs to forward arguments to a different function. Name of the parameter pack argument doesn't matter. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5168 llvm-svn: 217039
* [clang-tidy] Eliminate inline copies of InTemplateInstantiation matcher.Benjamin Kramer2014-09-035-25/+9
| | | | llvm-svn: 217036
* [clang-tidy] Use new ASTMatchers to identify template instantiations instead ↵Benjamin Kramer2014-09-033-13/+3
| | | | | | | | of copying it everywhere. No intended functionality change. llvm-svn: 217035
* Remove unused AST matcher.Benjamin Kramer2014-09-021-5/+0
| | | | llvm-svn: 216901
* [clang-tidy] Don't suggest naming the dummy argument of a post-inc operator ↵Benjamin Kramer2014-09-011-0/+6
| | | | | | overload. llvm-svn: 216868
* Try to fix test on msvc and 32 bit hosts.Benjamin Kramer2014-08-291-1/+1
| | | | llvm-svn: 216727
* [clang-tidy] Add a checker that suggests replacing short/long/long long with ↵Benjamin Kramer2014-08-294-0/+148
| | | | | | | | fixed-size types. Differential Revision: http://reviews.llvm.org/D5119 llvm-svn: 216726
* [clang-tidy] Don't suggest naming unnamed parameters on deleted/defaulted ↵Benjamin Kramer2014-08-291-1/+2
| | | | | | functions. llvm-svn: 216718
* Adjust call 'CreateAnalysisConsumer' due to API tweak.Ted Kremenek2014-08-271-3/+1
| | | | llvm-svn: 216551
* [clang-tidy] If we're going to change the header guard in the #endif commentBenjamin Kramer2014-08-261-13/+30
| | | | | | | | | we can also fix the original header guard. We still allow an _ at the end of a header guard since it's so common, but remove it now when the #endif comment is changed. llvm-svn: 216462
* [clang-tidy] Allow /**/ comments on #endifs when checking header guards.Benjamin Kramer2014-08-201-1/+2
| | | | | | Turning block comments into line comments just creates unecessary churn. llvm-svn: 216072
* AvoidCStyleCastsCheck: don't warn on casts in macrosAlexander Kornienko2014-08-161-4/+6
| | | | llvm-svn: 215799
* [CMake] Update libdeps in clangTidyLLVMModule.NAKAMURA Takumi2014-08-131-0/+1
| | | | llvm-svn: 215589
* In ancient times build targets had to be sorted topologically. Sometimes ↵Benjamin Kramer2014-08-131-1/+1
| | | | | | this behavior can still be observed today. llvm-svn: 215553
* Fix linking in the Makefile build.Benjamin Kramer2014-08-131-1/+1
| | | | llvm-svn: 215550
* [clang-tidy] Add a generic header guard checker + LLVM implementation.Benjamin Kramer2014-08-1310-1/+411
| | | | | | | | | | | | | | | | | | | | The implementation is split into a generic part and a LLVM-specific part. Other codebases can implement it with their own style. The specific features supported are: - Verification (and fixing) of header guards against a style based on the file path - Automatic insertion of header guards for headers that are missing them - A warning when the header guard doesn't enable our fancy header guard optimization (e.g. when there's an include preceeding the guard) - Automatic insertion of a comment with the guard name after #endif. For the LLVM style we disable #endif comments for now, they're not very common in the codebase. We also only flag headers in the include directories, there doesn't seem to be a common style outside. Differential Revision: http://reviews.llvm.org/D4867 llvm-svn: 215548
* [clang-tidy] Disable the warning on implicit bool* to bool conversion in macros.Benjamin Kramer2014-08-121-1/+9
| | | | | | It's just too noisy and the warning isn't very helpful in those cases. llvm-svn: 215439
* Recommit 213308: unique_ptr-ify ownership of ASTConsumers (reverted in r213324)David Blaikie2014-08-102-15/+16
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215324
* [clang-tidy] Don't index past the end of a vector.Benjamin Kramer2014-08-081-1/+2
| | | | | | We actually want the end iterator so just replace it with iterator arithmetic. llvm-svn: 215195
* [clang-tidy] Implement the include order checker for LLVM.Benjamin Kramer2014-08-071-9/+130
| | | | | | | | | | There are still a couple of rough edges in here but it is working fine on LLVM and generates the same results as sort_includes.py if there are no blank lines involved. Differential Revision: http://reviews.llvm.org/D4741 llvm-svn: 215152
* Rename ChecksFilter to GlobList, as there's nothing specific to checks in it.Alexander Kornienko2014-08-066-38/+38
| | | | | | | | | | | | | | | | | | Summary: Rename ChecksFilter to GlobList, as there's nothing specific to checks in it. It's a rather generic way to represent sets of strings (or patterns), so it may be used for something else in ClangTidy. The new name would not look strange when used to filter other entities. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4806 llvm-svn: 214961
* [clang-tidy] Simplify ast matcher.Benjamin Kramer2014-08-051-11/+2
| | | | | | Turns out there is a better way to do this. No functionality change. llvm-svn: 214874
* [clang-tidy] Rewrite a for-range loop in the old style.Benjamin Kramer2014-08-041-3/+3
| | | | | | | | Haven't thought that I ever needed to do this, but in this case comparing the index using pointer arithmetic turns out to be really ugly. It also generates nasty sign-compare warnings on 32 bit targets. llvm-svn: 214705
* [clang-tidy] Fix unnamed parameter comment insertion with multiple parameters.Benjamin Kramer2014-08-041-3/+3
| | | | llvm-svn: 214703
* [clang-tidy] Make the named parameter check only warn on declarations if a ↵Benjamin Kramer2014-08-041-11/+28
| | | | | | | | | | | | | | | | definition is visible. Summary: This allows us to copy the parameter name from the definition (as a comment) or insert /*unused*/ in both places. Reviewers: alexfh, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4772 llvm-svn: 214701
* [clang-tidy] Add a checker for code that looks like a delegate constructors ↵Benjamin Kramer2014-07-314-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | but doesn't delegate. Summary: class Foo { Foo() { Foo(42); // oops } Foo(int); }; This is valid code but it does nothing and we can't emit a warning in clang because there might be side effects. The checker emits a warning for this pattern and also for base class initializers written in this style. There is some overlap with the unused-rtti checker but they follow different goals and fire in different places most of the time. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4667 llvm-svn: 214397
* Don't warn on NewCallback argument comments, as they are arguments for theAlexander Kornienko2014-07-301-4/+9
| | | | | | | | | | | | | | function the callback points to. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4722 llvm-svn: 214307
* clang-tidy: [use-override] Tweak messages.Daniel Jasper2014-07-281-2/+2
| | | | | | | | It doesn't make sense to suggest 'virtual' as clang-tidy would complain about that on the next iteration (we are never issuing warnings for the base function). llvm-svn: 214063
* Plug memory leaks.Benjamin Kramer2014-07-241-5/+5
| | | | | | | Most of the changes are mechanic std::unique_ptr insertions. All leaks were detected by LeakSanitizer. llvm-svn: 213851
* [clang-tidy] Fix a heap use-after-free bug detected by asan.Benjamin Kramer2014-07-241-4/+4
| | | | llvm-svn: 213845
* Add the fix that should've accompanied r213738.Benjamin Kramer2014-07-231-3/+6
| | | | llvm-svn: 213740
OpenPOWER on IntegriCloud