summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
* [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-186-1/+128
| | | | | | | | | 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
* Rename unit test argument and add argument comments for clarity.Benjamin Kramer2014-09-171-19/+28
| | | | | | NFC llvm-svn: 217947
* [clang-tidy] When emitting header guard fixes bundle all fix-its into oneBenjamin Kramer2014-09-162-28/+48
| | | | | | | | | 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-155-0/+211
| | | | | | | | | | | | | | | | 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-1235-58/+263
| | | | | | | | | | | | | | | | | 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-102-0/+21
| | | | | | | | newlines involved. Getting that right is just not worth it. llvm-svn: 217480
* Unique_ptrify PPCallbacks ownership. Goes with clang r217474.Craig Topper2014-09-106-7/+12
| | | | llvm-svn: 217475
* clang-apply-replacements: For-rangify.Benjamin Kramer2014-09-092-29/+20
| | | | | | No functionality change. llvm-svn: 217442
* clang-apply-replacements: Deduplicate paths with FileManager.Benjamin Kramer2014-09-094-46/+45
| | | | | | | | Bucket replacements by FileEntry instead of path. The same file with different paths is very common, relative #include paths and symlinks can easily create them. When that occurs we would apply the fix twice. llvm-svn: 217440
* Fixed a typo.Alexander Kornienko2014-09-081-1/+2
| | | | llvm-svn: 217377
* 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 couple of paragraphs on run-clang-tidy.py to the docs.Benjamin Kramer2014-09-081-0/+30
| | | | | | Happy tidying. llvm-svn: 217373
* Move clang-tools-extra docs 1.5 years into the future.Benjamin Kramer2014-09-081-2/+2
| | | | llvm-svn: 217369
* [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
* Plug a unit test memory leak.Benjamin Kramer2014-09-041-1/+2
| | | | | | MatchFinder.addMatcher doesn't take ownership. llvm-svn: 217162
* Implemented clang-tidy configurability via .clang-tidy files.Alexander Kornienko2014-09-0414-50/+280
| | | | | | | | | | | | | | | | | 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-044-1/+38
| | | | | | | | 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-032-3/+23
| | | | | | | | | | | | | | | | | | | 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-022-5/+5
| | | | llvm-svn: 216901
* [clang-tidy] Don't suggest naming the dummy argument of a post-inc operator ↵Benjamin Kramer2014-09-012-3/+25
| | | | | | overload. llvm-svn: 216868
* Try to fix test on msvc and 32 bit hosts.Benjamin Kramer2014-08-292-5/+5
| | | | llvm-svn: 216727
* [clang-tidy] Add a checker that suggests replacing short/long/long long with ↵Benjamin Kramer2014-08-295-0/+202
| | | | | | | | 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-292-1/+5
| | | | | | functions. llvm-svn: 216718
* Remove call to llvm::makeArrayRef. Implicit conversion is sufficient.Craig Topper2014-08-291-1/+1
| | | | llvm-svn: 216711
* Update for Clang API change.David Blaikie2014-08-272-4/+3
| | | | llvm-svn: 216615
* Update for LLVM api change.Rafael Espindola2014-08-272-4/+6
| | | | llvm-svn: 216584
* Adjust call 'CreateAnalysisConsumer' due to API tweak.Ted Kremenek2014-08-271-3/+1
| | | | llvm-svn: 216551
* Simplify creation of a couple ArrayRefs by using None and makeArrayRef.Craig Topper2014-08-271-2/+2
| | | | llvm-svn: 216529
* [clang-tidy] If we're going to change the header guard in the #endif commentBenjamin Kramer2014-08-262-13/+44
| | | | | | | | | 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
* Update for LLVM api changeRafael Espindola2014-08-256-27/+22
| | | | llvm-svn: 216396
* [clang-tidy] Allow /**/ comments on #endifs when checking header guards.Benjamin Kramer2014-08-202-1/+32
| | | | | | Turning block comments into line comments just creates unecessary churn. llvm-svn: 216072
* Revert rL215947: "[clang-rename] revert r215839"Manuel Klimek2014-08-2019-2/+1007
| | | | | | Make tests not depend on grep supporting -bo. llvm-svn: 216041
* [clang-rename] revert r215839Gerolf Hoflehner2014-08-1819-1005/+2
| | | | | | | | | | | | | | | | | | | | The commit broke public build bots for more than 24 hours. (view as text) ******************** TEST 'Clang Tools :: clang-rename/VarTest.cpp' FAILED ******************** Script: -- cat /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp clang-rename -offset=$(grep -FUbo 'foo;' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | head -1 | cut -d: -f1) -new-name=hector /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp -i -- sed 's,//.*,,' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | FileCheck /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp -- Exit Code: 1 Command Output (stderr): -- clang-rename: could not find symbol at /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp:2:1 (offset 14). llvm-svn: 215947
* [CMake] clang-rename: Optimize libdeps.NAKAMURA Takumi2014-08-181-9/+0
| | | | llvm-svn: 215935
* Add trailing linefeed.NAKAMURA Takumi2014-08-181-1/+1
| | | | llvm-svn: 215934
* Revert r215854 corresponding to r215857, "Suppress ↵NAKAMURA Takumi2014-08-171-2/+1
| | | | | | ClangRenameTests/USRLocFinding.FindsVarUSR on msc17 for now. Will fix later." llvm-svn: 215859
* Remove initializer list.Manuel Klimek2014-08-171-5/+12
| | | | llvm-svn: 215857
* Suppress ClangRenameTests/USRLocFinding.FindsVarUSR on msc17 for now. Will ↵NAKAMURA Takumi2014-08-171-1/+2
| | | | | | fix later. llvm-svn: 215854
* Fix link libraries for clang-rename.Manuel Klimek2014-08-171-0/+7
| | | | llvm-svn: 215843
* Remove mention of non-existent 'test' directory.Manuel Klimek2014-08-171-3/+0
| | | | llvm-svn: 215840
OpenPOWER on IntegriCloud