summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Force braces on the else branch if they are being added to the if branch.Samuel Benzaquen2015-03-312-5/+27
| | | | | | | | | | | | | | Summary: Force braces on the else branch if they are being added to the if branch. This ensures consistency in the transformed code. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8708 llvm-svn: 233697
* Fix false positive on anonymous namespaces in headers.Samuel Benzaquen2015-03-241-0/+4
| | | | | | | | | | | | | | | | Summary: Anynoumous namespaces inject a using directive into the AST to import the names into the containing namespace. We should not have them in headers, but there is another warning for that. Reviewers: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8443 llvm-svn: 233087
* [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC.Alexander Kornienko2015-03-091-3/+3
| | | | | | | | | | The patch was generated using this command: $ clang-tidy/tool/run-clang-tidy.py -header-filter=.*clang-tidy.* -fix \ -checks=-*,llvm-header-guard clang-tidy.* $ svn revert --recursive clangt-tidy/llvm/ (to revert a few buggy fixes) llvm-svn: 231669
* [clang-tidy] Slighly clarified a comment.Alexander Kornienko2015-03-051-1/+2
| | | | llvm-svn: 231370
* [clang-tidy] Replace unrecognized namespace ending comments.Alexander Kornienko2015-03-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: Replace unrecognized namespace ending comments. This will help in particular when a namespace ending comment is mistyped or doesn't fit the regexp for other reason, e.g.: namespace a { namespace b { namespace { } // anoynmous namespace } // b } // namesapce a Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D8078 llvm-svn: 231369
* [clang-tidy] Refactor: Move google clang-tidy checks to namespace ↵Alexander Kornienko2015-03-051-0/+2
| | | | | | | | | | clang::tidy::google http://reviews.llvm.org/D7994 Patch by Richard Thomson! llvm-svn: 231364
* clang-tidy: Update test as underlying problem apparently was fixed.Daniel Jasper2015-03-021-2/+1
| | | | llvm-svn: 230982
* [clang-tidy] Refactor: Move llvm clang-tidy checks to namespace ↵Alexander Kornienko2015-03-021-0/+2
| | | | | | | | | | | | | clang::tidy::llvm clang-tidy checks are organized into modules. This refactoring moves the llvm module checks to clang::tidy::llvm http://reviews.llvm.org/D7995 Patch by Richard Thomson! llvm-svn: 230952
* [clang-tidy] Refactor: Move misc clang-tidy checks to namespace ↵Alexander Kornienko2015-03-021-0/+2
| | | | | | | | | | | | | clang::tidy::misc clang-tidy checks are organized into modules. This refactoring moves the misc module checks into the namespace clang::tidy::misc http://reviews.llvm.org/D7996 Patch by Richard Thomson! llvm-svn: 230950
* [clang-tidy] Organized clang-tidy unit tests. NFC.Alexander Kornienko2015-03-024-338/+333
| | | | | | | | | * Moved unit tests for BracesAroundStatementsCheck to ReadabilityModuleTest.cpp. * Moved EXPECT_NO_CHANGES macro to ClangTidyTest.h to avoid defining it three times. llvm-svn: 230947
* Revert "Adapt clang-tools-extra to clang module format changes."Adrian Prantl2015-02-251-3/+2
| | | | | | This reverts commit 230424. llvm-svn: 230456
* Adapt clang-tools-extra to clang module format changes.Adrian Prantl2015-02-251-2/+3
| | | | | | | - add clangCodeGen.a to the tools that need it - tweak pp-trace command line handling to not conflict with clang's. llvm-svn: 230424
* Revert "Adapt Makefile dependencies for the clang module format change in ↵Adrian Prantl2015-02-211-3/+3
| | | | | | r230089." llvm-svn: 230104
* Adapt Makefile dependencies for the clang module format change in r230089.Adrian Prantl2015-02-201-3/+3
| | | | llvm-svn: 230090
* Add clang-tidy check google-global-names-in-headers.Samuel Benzaquen2015-02-111-0/+46
| | | | | | | | | | | | | | Summary: google-global-names-in-headers flags global namespace pollution in header files. Right now it only triggers on using declarations and directives. Reviewers: alexfh Subscribers: curdeius Differential Revision: http://reviews.llvm.org/D7563 llvm-svn: 228875
* [CMake] Add dependencies on clangToolingCore.NAKAMURA Takumi2014-10-301-0/+1
| | | | llvm-svn: 220890
* Fix Makefiles after r220867.Daniel Jasper2014-10-291-1/+2
| | | | llvm-svn: 220868
* [clang-tidy] Bring order to check registration.Alexander Kornienko2014-10-262-4/+4
| | | | | | | | | | | | | | | | Summary: Register readability checks in a separate module. Renamed the checks and test file names accordingly. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5936 llvm-svn: 220631
* [clang-tidy] Minor fixes for the NamespaceCommentCheck.Alexander Kornienko2014-10-161-0/+8
| | | | | | | | * Make SmallVector size enough for all groups. * Allow trailing period in the comment. * Fix "// anonymous namespace qqq". llvm-svn: 219926
* Fix llvm-header-guard check.Alexander Kornienko2014-10-151-3/+13
| | | | | | | | | | | | | | | | | Summary: This patch makes the check work better for LLVM code: * always fix existing #endif comments * use one space before the comment (+allow customization for other styles) Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5795 llvm-svn: 219789
* Reformatted code samples in the unit test. No functional changes.Alexander Kornienko2014-10-151-64/+111
| | | | llvm-svn: 219788
* [clang-tidy] Move some of the misc checks to readability/Alexander Kornienko2014-10-151-1/+4
| | | | | | | | | | | | | | | | | | | Summary: Some of the misc checks belong to readability/. I'm moving them there without changing check names for now. As the next step, I want to register some of these checks in the google and llvm modules with suitable settings (e.g. BracesAroundStatementsCheck). I'm not sure if we want to create a "readability" module, probably not. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5792 llvm-svn: 219786
* Small cleanups from review comments.Manuel Klimek2014-10-091-5/+3
| | | | llvm-svn: 219409
* Make clang-tidy's runCheckOnCode actually use the DiagnosticConsumer.Manuel Klimek2014-10-072-19/+27
| | | | | | | | | A precondition of that was to run both the preprocessor checks and AST checks from the same FrontendAction, otherwise we'd have needed to duplicate all involved objects in order to not have any references to a deleted source manager. llvm-svn: 219212
* [clang-tidy] Add check misc-braces-around-statements.Alexander Kornienko2014-10-021-0/+329
| | | | | | | | | | | | | | | | | | | | | | | | | | | This check looks for if statements and loops: for, range-for, while and do-while, and verifies that the inside statements are inside braces '{}'. If not, proposes to add braces around them. Example: if (condition) action(); becomes if (condition) { action(); } This check ought to be used with the -format option, so that the braces be well-formatted. Patch by Marek Kurdej! http://reviews.llvm.org/D5395 llvm-svn: 218898
* Provide user name in ClangTidyOptions.Alexander Kornienko2014-09-241-9/+10
| | | | | | | | | | | | | | | | | | | Summary: This adds the ClangTidyOptions::User field and fills it from the USER or the USERNAME environment variable, if possible. The FileOptionsProvider now takes "default" options instead of "fallback" options, as it now uses these when an option is not set in the configuration file (one exception is the checks list). Reviewers: bkramer, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5440 llvm-svn: 218402
* 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
OpenPOWER on IntegriCloud