aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/tool/ClangTidyMain.cpp
AgeCommit message (Collapse)Author
2015-03-23Make helpers static. clang-tools edition.Benjamin Kramer
Also purge dead code found by it. NFC. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@232948 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09[clang-tidy] Fix a typo.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@223777 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03[clang-tidy] Update help messages and docs.Alexander Kornienko
Fixed incorrect examples of configuration, clarified the usage of -dump-config. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@223235 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03[clang-tidy] Added -fix-errors optionAlexander Kornienko
Summary: Added -fix-errors option to allow applying fixes when compiler errors are present. Without this flag -fix would bail out if there are compiler errors. This is needed to avoid applying wrong fixes if Clang fails to recover from compilation errors correctly. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D6059 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@221152 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-29Shrink the set of checks enabled by default.Alexander Kornienko
Summary: Enable only compiler diagnostics and safe static analyzer checks by default. Let the defaults be conservative and safe for an average project. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6027 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@220865 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28[clang-tidy] Added -system-headers option.Alexander Kornienko
Added -system-headers option to allow display of warnings from system headers. This is needed for testing libcxx, for example. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@220826 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-26[clang-tidy] Bring order to check registration.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@220631 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23Add flag --enable-check-profile to clang-tidy.Samuel Benzaquen
Summary: Add flag --enable-check-profile to clang-tidy. It turns on per-matcher profiles in MatchFinder and prints a report to stderr at the end. Reviewers: alexfh Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5937 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@220491 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26Fix a typoAlexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@218512 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26[clang-tidy] Add a -config={YAML} option.Alexander Kornienko
Summary: Add -config option to allow specifying configuration in YAML/JSON format on the command line. Reviewers: klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5501 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@218511 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24Provide user name in ClangTidyOptions.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@218402 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12Implemented clang-tidy-check-specific options.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217661 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10Moved main() to the clang::tidy namespace, no functional changes.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217493 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04Don't write files with no fixes.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04Implemented clang-tidy configurability via .clang-tidy files.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217155 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04[clang-tidy] Add an option to export suggested fixes into a file.Benjamin Kramer
Allows gathering fixes and applying them with clang-apply-fixes. Differential Revision: http://reviews.llvm.org/D5176 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12Replace llvm::error_code with std::error_code.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210776 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-05Allow per-file clang-tidy options.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210260 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-02Exit with error when no checks enabled.Alexander Kornienko
Summary: This seems like a more appropriate reaction to the user specifying a single check with a wrong name, for example. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3981 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210043 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-22Add clang-tidy -line-filter option to filter findings by line ranges.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@209450 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-19Improved llvm-namespace-comment check.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@209141 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-16Update clang-tidy documentation.Alexander Kornienko
Summary: Updated the help message, updated description of -checks=, removed mentions of -disable-checks. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3793 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208979 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15Change the behavior of clang-tidy -checks=, remove -disable-checks.Alexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208883 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-09Store Errors inside ClangTidyContext instead of just pointer to an externalAlexander Kornienko
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07Print stats on displayed and ignored warnings.Alexander Kornienko
Summary: Also displays a hint to use -header-filter='.*' in case any warnings are in non-user code. This will help discoverability of this option. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3621 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@208174 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-05Add clang-tidy -header-filter optionAlexander Kornienko
Summary: Add clang-tidy -header-filter option to specify from which headers we want diagnostics to be printed. By default we don't print diagnostics from headers. We always print diagnostics from the main file of each translation unit. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3590 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-30Add a clang-tidy flag to support temporary destructor-aware analysis ↵Alex McCarthy
(workaround for bug 15599). Reviewers: alexfh Subscribers: jordan_rose, klimek, djasper, cfe-commits Differential Revision: http://reviews.llvm.org/D3556 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207652 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-29Add ClangTidyOptions to encapsulate all clang-tidy options.Alexander Kornienko
Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3544 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207532 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-29Fix typo (first commit to test commit access).Alex McCarthy
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@207490 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-02Fix regex bug in clang-tidy.Daniel Jasper
Also make tests slightly less dependent on default flags. Once we have implemented configuration file support, we might want to store the clang-tidy configuration for the tests there. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@205408 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-02Disable a few clang-tidy checks by default.Daniel Jasper
The goal is to be able to run clang-tidy on LLVM files without further configuration for now. Once llvm.org/PR19306 is addressed, we can add a configuration file instead and choose other defaults. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@205407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05Added a module for checks not related to LLVM or Google coding style.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@202970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05Make the OptionCategory variable static.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@200841 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19Clang-tidy: added --disable-checks, --list-checks options.Alexander Kornienko
Summary: Allow disabling checks by regex. By default, disable alpha.* checks, that are not particularly good tested (e.g. IdempotentOperationChecker, see http://llvm-reviews.chandlerc.com/D2427). Fixed a bug, that would disable all analyzer checks, when using a regex more strict, than 'clang-analyzer-', for example --checks='clang-analyzer-deadcode-'. Added --list-checks to list all enabled checks. This is useful to test specific values in --checks/--disable-checks. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2444 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@197717 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-12Fix the usage of the CommonOptionsParser ctor changed in r197139.Alexander Kornienko
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@197141 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-14Make clang's static analyzer checks available through clang-tidy.Manuel Klimek
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. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@194707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-04Fix clang-tidy dependencies and bad file comment.Daniel Jasper
This addresses comments in post-commit review of r187345. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@187707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-31Remove dead #includes.Hans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@187536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-29Fix build error caused by r187345.Daniel Jasper
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@187346 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-29Initial architecture for clang-tidy.Daniel Jasper
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@187345 91177308-0d34-0410-b5e6-96231b3b80d8