summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests
Commit message (Collapse)AuthorAgeFilesLines
* Implemented clang-tidy-check-specific options.Alexander Kornienko2014-09-123-5/+7
| | | | | | | | | | | | | | | | | 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
* [clang-tidy] Don't try to fix header guard #endif comments if there are escapedBenjamin Kramer2014-09-101-0/+14
| | | | | | | | newlines involved. Getting that right is just not worth it. llvm-svn: 217480
* 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-042-5/+7
| | | | | | | | | | | | | | | | | 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
* Update for Clang API change.David Blaikie2014-08-271-1/+1
| | | | llvm-svn: 216615
* Update for LLVM api change.Rafael Espindola2014-08-271-2/+3
| | | | llvm-svn: 216584
* [clang-tidy] If we're going to change the header guard in the #endif commentBenjamin Kramer2014-08-261-0/+14
| | | | | | | | | 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-0/+30
| | | | | | Turning block comments into line comments just creates unecessary churn. llvm-svn: 216072
* Revert rL215947: "[clang-rename] revert r215839"Manuel Klimek2014-08-204-0/+142
| | | | | | Make tests not depend on grep supporting -bo. llvm-svn: 216041
* [clang-rename] revert r215839Gerolf Hoflehner2014-08-184-142/+0
| | | | | | | | | | | | | | | | | | | | 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
* 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
* First version of a clang-rename tool.Manuel Klimek2014-08-174-0/+135
| | | | | | | | | | | | | | | | Summary: Note that this code is still grossly under-tested - the next steps will be to add significantly better test coverage. Patch by Matthew Plant. Test Plan: Reviewers: Subscribers: llvm-svn: 215839
* ClangTidyTests: Suppress FixHeaderGuards on win32 for now.NAKAMURA Takumi2014-08-131-0/+3
| | | | | FIXME: It seems this might be incompatible to dos path. Investigating. llvm-svn: 215590
* 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
* [clang-tidy] Add a generic header guard checker + LLVM implementation.Benjamin Kramer2014-08-131-0/+41
| | | | | | | | | | | | | | | | | | | | 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
* Allow specifying file names and extra arguments when running clang-tidy unit ↵Benjamin Kramer2014-08-121-3/+7
| | | | | | | | tests. Will become useful soon. llvm-svn: 215438
* Recommit 213308: unique_ptr-ify ownership of ASTConsumers (reverted in r213324)David Blaikie2014-08-101-2/+2
| | | | | | | | 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
* Rename ChecksFilter to GlobList, as there's nothing specific to checks in it.Alexander Kornienko2014-08-061-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
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-2/+2
| | | | | | | | | This reverts commit r213308. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213324
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-2/+2
| | | | llvm-svn: 213308
* Track clang r213171Alp Toker2014-07-163-3/+3
| | | | | | The clang rewriter is now a core facility. llvm-svn: 213172
* [CMake] Update libdeps.NAKAMURA Takumi2014-07-141-0/+1
| | | | llvm-svn: 212920
* Move google-explicit-constructor check to a separate source file.Alexander Kornienko2014-06-181-1/+1
| | | | | | | | | | | | | | Summary: No functional changes. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4188 llvm-svn: 211154
* include system_error directly.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210797
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-125-17/+17
| | | | llvm-svn: 210776
* [C++11] Use 'nullptr'.Craig Topper2014-06-092-2/+2
| | | | llvm-svn: 210447
* Allow per-file clang-tidy options.Alexander Kornienko2014-06-052-5/+17
| | | | | | | | | | | | | | | | | | Summary: This patch makes it possible for clang-tidy clients to provide different options for different translation units. The option, which doesn't make sense to be file-dependent, was moved to a separate ClangTidyGlobalOptions struct. Added parsing of ClangTidyOptions. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3979 llvm-svn: 210260
* Don't assume an implicit error_code -> bool operator.Rafael Espindola2014-06-031-5/+5
| | | | llvm-svn: 210070
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-4/+4
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209953
* ClangTidyOptionsTest.cpp: Rewrite literals. Raw string literals are ↵NAKAMURA Takumi2014-05-241-7/+8
| | | | | | unavailable on msc17. llvm-svn: 209583
* Add clang-tidy -line-filter option to filter findings by line ranges.Alexander Kornienko2014-05-222-0/+59
| | | | | | | | | | | | | | | | | Summary: This is going to be used for a clang-tidy-diff script to display warnings in changed lines only. The option uses JSON, as its value is not intended to be entered manually. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3873 llvm-svn: 209450
* Improved llvm-namespace-comment check.Alexander Kornienko2014-05-191-1/+75
| | | | | | | | | | | | | | | | | | | Summary: Handle various forms of existing namespace closing comments, fix existing comments with wrong namespace name, ignore short namespaces. The state of this check now seems to be enough to enable it by default to gather user feedback ;) Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3825 llvm-svn: 209141
* Fixed incorrect StringRef::find usage.Alexander Kornienko2014-05-151-3/+3
| | | | llvm-svn: 208898
* Change the behavior of clang-tidy -checks=, remove -disable-checks.Alexander Kornienko2014-05-151-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make checks filtering more intuitive and easy to use. Remove -disable-checks and change the format of -checks= to a comma-separated list of globs with optional '-' prefix to denote exclusion. The -checks= option is now cumulative, so it modifies defaults, not overrides them. Each glob adds or removes to the current set of checks, so the filter can be refined or overriden by adding globs. Example: The default value for -checks= is '*,-clang-analyzer-alpha*,-llvm-include-order,-llvm-namespace-comment,-google-*', which allows all checks except for the ones named clang-analyzer-alpha* and others specified with the leading '-'. To allow all google-* checks one can write: clang-tidy -checks=google-* ... If one needs only google-* checks, we first need to remove everything (-*): clang-tidy -checks=-*,google-* etc. I'm not sure if we need to change something here, so I didn't touch the docs yet. Reviewers: klimek, alexfh Reviewed By: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3770 llvm-svn: 208883
* Store Errors inside ClangTidyContext instead of just pointer to an externalAlexander Kornienko2014-05-092-10/+8
| | | | | | | | | | | | | | | array. This simplifies usage of ClangTidyContext a bit and seems to be more consistent. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3685 llvm-svn: 208407
* Fix assertion in google-explicit-constructor check when the constructor isAlexander Kornienko2014-05-051-0/+9
| | | | | | | | | | | | | | | | | | defined in a macro. Summary: We shouldn't suggest replacements in macros anyway, as we can't see all usages of the macro and ensure the replacement is safe for all of them. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3611 llvm-svn: 207987
* Fix the message for "Move constructor declared explicit".Alexander Kornienko2014-04-291-4/+4
| | | | | | Make the tests for removal of 'explicit' more diverse. llvm-svn: 207534
* Add ClangTidyOptions to encapsulate all clang-tidy options.Alexander Kornienko2014-04-291-5/+3
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3544 llvm-svn: 207532
* Warn on explicit copy constructors.Alexander Kornienko2014-04-291-0/+10
| | | | | | | | | | | | | | | | | Summary: The Google C++ Style Guide doesn't require copy constructors to be declared explicit, but some people do this by mistake. Make this check detect and fix such cases. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3541 llvm-svn: 207531
* Try to fix the build. newFrontendActionFactory was changed to return a ↵Benjamin Kramer2014-04-281-2/+3
| | | | | | unique_ptr. llvm-svn: 207407
* Remove unnecessary explicit unique_ptr ctors now that buildASTFromCode ↵David Blaikie2014-04-251-4/+4
| | | | | | returns a unique_ptr instead of a raw pointer. llvm-svn: 207238
* Slightly less blindly fixing clang-tools-extra now that I remember that the ↵David Blaikie2014-04-252-14/+13
| | | | | | "check-clang" target doesn't check clang-tools-extra llvm-svn: 207231
* QueryEngineTest.cpp: Appease g++47.NAKAMURA Takumi2014-04-241-1/+1
| | | | llvm-svn: 207097
* ClangQueryTests: Fix msc17 build. Non-static member initializers are ↵NAKAMURA Takumi2014-04-242-11/+20
| | | | | | unavailable. llvm-svn: 207096
* Add new 'let' command to bind arbitrary values into constants.Samuel Benzaquen2014-04-232-40/+112
| | | | | | | | | | | | | | Summary: Add new 'let' command to bind arbitrary values into constants. These constants can then be used in the matcher expressions. Reviewers: pcc CC: cfe-commits Differential Revision: http://reviews.llvm.org/D3383 llvm-svn: 206984
* Output clang-tidy errors in a consistent order.Alexander Kornienko2014-04-083-2/+42
| | | | | | | | | | | | | | Summary: Sort errors by path, file offset and message. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://reviews.llvm.org/D3314 llvm-svn: 205759
* Removed unused includeAlexander Kornienko2014-03-231-1/+0
| | | | llvm-svn: 204551
* ClangTidyTest.h: Don't use initializer list. msc17 doesn't recognize one.NAKAMURA Takumi2014-03-201-2/+3
| | | | llvm-svn: 204332
OpenPOWER on IntegriCloud