summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* ClangTidyTests: Add dependency on clangTidyUtils.NAKAMURA Takumi2014-09-231-0/+1
| | | | | | I missed to add it since I suppressed checks on win32 in r215590. llvm-svn: 218289
* Add NamespaceCommentCheck to the Google module.Alexander Kornienko2014-09-224-80/+95
| | | | | | | | | | | | | | | | | Summary: This uses a bit hacky way to set the defaults for the spaces before comments, but it's also one of the simplest ways. Fixed a bug with how the SpacesBeforeComments option was used. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5410 llvm-svn: 218240
* 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-161-11/+17
| | | | | | | | | 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
* 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
* 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
* [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
* 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
* 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
* Track clang r213171Alp Toker2014-07-161-1/+1
| | | | | | The clang rewriter is now a core facility. llvm-svn: 213172
* 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
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-5/+5
| | | | llvm-svn: 210776
* 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
* 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
* 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
* clang-tidy explicit constructor check: don't warn on copy or move constructors.Alexander Kornienko2014-03-201-0/+4
| | | | | | | | | | | | | | | | | Summary: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Explicit_Constructors "The exception is copy constructors, which, in the rare cases when we allow them, should probably not be explicit." Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3122 llvm-svn: 204322
* Post-filter clang-tidy diagnostic messages.Alexander Kornienko2014-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements filtering of clang-tidy diagnostic messages by the check name, so that "clang-tidy -checks=^llvm-" won't output any clang warnings, for example. This is also helpful to run specific static-analyzer checks: static analyzer always needs core checks to be enabled, but the user may be interested only in the checks he asked for. This patch also exposes warning option names for built-in diagnostics. We need to have a namespace for these names to avoid collisions and to allow convenient filtering, so I prefix them with "-W". I'm not sure it's the best thing to do, and maybe "W" or "clang-diagnostic-" or something like this would be better. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3121 llvm-svn: 204321
* clang-tidy explicit constructors check: don't warn on deleted constructors.Alexander Kornienko2014-03-192-2/+5
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3116 llvm-svn: 204226
* Add an argument comment checker to clang-tidy.Peter Collingbourne2014-03-183-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | This checks that parameters named in comments that appear before arguments in function and constructor calls match the parameter name used in the callee's declaration. For example: void f(int x, int y); void g() { f(/*y=*/0, /*z=*/0); } contains two violations of the policy, as the names 'x' and 'y' used in the declaration do not match names 'y' and 'z' used at the call site. I think there is significant value in being able to check/enforce this policy as a way of guarding against accidental API misuse and silent breakages caused by API changes. Although this pattern appears somewhat frequently in the LLVM codebase, this policy is not prescribed by the LLVM coding standards at the moment, so it lives under 'misc'. Differential Revision: http://llvm-reviews.chandlerc.com/D2914 llvm-svn: 204113
* [C++11] Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-091-1/+1
| | | | | | | | This removes all references to OwningPtr, which should be fairly undisruptive to out-of-tree projects since they are unlikely to use clang-tools-extra as a library instead of a set of tools. llvm-svn: 203382
* [C++11] Replace LLVM_OVERRIDE with 'override'Craig Topper2014-03-021-1/+1
| | | | llvm-svn: 202632
* Made the ClangTidyTest helper class independent of the testing framework.Alexander Kornienko2014-02-273-57/+59
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2895 llvm-svn: 202399
* Fix ExplicitConstructorCheck to warn only on in-class declarations.Alexander Kornienko2014-02-131-0/+5
| | | | | | | | | | | | | | | | Summary: I'm not absolutely sure this is 100% correct solution, but it seems to do what I expect. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2756 llvm-svn: 201308
* Re-applied r198807, r198808 with an additional change to fix linking in ↵Alexander Kornienko2014-01-091-0/+1
| | | | | | configure Release+Asserts build. llvm-svn: 198875
* Run llvm/utils/sort_includes.py over the Clang tools code. This doesn'tChandler Carruth2014-01-072-2/+0
| | | | | | | | | | always produce as pretty of results as it does in LLVM and Clang, but I don't mind and the value of having a single canonical ordering is very high IMO. Let me know if you spot really serious problems here. llvm-svn: 198703
* [CMake] clang-tools-extra: Update dependencies.NAKAMURA Takumi2013-12-101-5/+5
| | | | llvm-svn: 196860
* Make clang's static analyzer checks available through clang-tidy.Manuel Klimek2013-11-142-0/+3
| | | | | | | | | | | | | This is implemented in a way that the current static analyzer architecture allows, in the future we might want to revisit this. With this change static analyzer checks are available from clang-tidy by specifying -checks=clang-analyzer-<name>. This change also fixes the use of the compilation database to allow clang-tidy to be used like any other clang tool. llvm-svn: 194707
* Add dependencies on TransformUtils library in preparation for re-applying ↵Alexey Samsonov2013-08-191-1/+2
| | | | | | r188666 llvm-svn: 188674
* Fix clang-tidy dependencies and bad file comment.Daniel Jasper2013-08-041-0/+2
| | | | | | This addresses comments in post-commit review of r187345. llvm-svn: 187707
* Initial architecture for clang-tidy.Daniel Jasper2013-07-295-0/+160
This is the first version of a possible clang-tidy architecture. The purpose of clang-tidy is to detect errors in adhering to common coding patterns, e.g. described in the LLVM Coding Standards. This is still heavily in flux. Review: http://llvm-reviews.chandlerc.com/D884 llvm-svn: 187345
OpenPOWER on IntegriCloud