summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add ExtraArgs and ExtraArgsBefore options to enable clang warnings via ↵Alexander Kornienko2015-11-091-3/+8
| | | | | | | | | | | | | | configuration files. Summary: This patch depends on http://reviews.llvm.org/D14191 Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14192 llvm-svn: 252485
* Replacements in different files do not overlap.Angel Garcia Gomez2015-10-161-16/+22
| | | | | | | | | | | | Summary: Prevent clang-tidy from discarding fixes that are in different files but happen to have the same file offset. Reviewers: klimek, bkramer Subscribers: bkramer, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13810 llvm-svn: 250523
* Empty undefined static variable -> local variable.Benjamin Kramer2015-10-161-1/+1
| | | | | | Resolves a -Wundefined-internal warning from clang. llvm-svn: 250510
* Fix overlapping replacements in clang-tidy.Angel Garcia Gomez2015-10-161-25/+143
| | | | | | | | | | | | Summary: Prevent clang-tidy from applying fixes to errors that overlap with other errors' fixes, with one exception: if one fix is completely contained inside another one, then we can apply the big one. Reviewers: bkramer, klimek Subscribers: djasper, cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D13516 llvm-svn: 250509
* [clang-tidy] Ignore spaces in -checks=Alexander Kornienko2015-09-161-1/+1
| | | | llvm-svn: 247812
* Test commit.Marek Kurdej2015-09-141-2/+1
| | | | llvm-svn: 247536
* Reapplying r246209, which exposed language options to the checkers. This ↵Aaron Ballman2015-08-281-0/+1
| | | | | | time disable UseNullptrCheck when not compiling in C++ mode, but still allow in C++11 mode since it's likely the user wishes to modernize their code. llvm-svn: 246298
* Reverting r246209 while I investigate a build bot failure: ↵Aaron Ballman2015-08-271-1/+0
| | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516 llvm-svn: 246224
* Expose language options to the checkers; disable UseNullptrCheck when not ↵Aaron Ballman2015-08-271-0/+1
| | | | | | compiling in C++11 mode. llvm-svn: 246209
* Lazily initialize HeaderFilter in ClangTidyDiagnosticConsumer. ThisDaniel Jasper2015-08-121-10/+8
| | | | | | | | | removes a corner case in tests that don't set the diagnostic consumer. In tests, it is good, not to set the diagnostic consumer so that Clang's parsing diagnostics are still displayed in the test output and only ClangTidy's output is analyzed differently. llvm-svn: 244745
* [clang-tidy] Count errors in ClangTidyDiagnosticConsumerAlexander Kornienko2014-11-201-0/+3
| | | | | | | This re-applies r222363 reverted in r222390 after compilation errors in our out-of-tree clang-tidy tests were fixed. llvm-svn: 222427
* Revert r222363: "[clang-tidy] Count errors in ClangTidyDiagnosticConsumer"Hans Wennborg2014-11-191-3/+0
| | | | | | | This was causing clang-tidy invocations that would previously pass despite source errors to fail. llvm-svn: 222390
* [clang-tidy] Count errors in ClangTidyDiagnosticConsumerAlexander Kornienko2014-11-191-0/+3
| | | | llvm-svn: 222363
* [clang-tidy] Added -system-headers option.Alexander Kornienko2014-10-281-1/+2
| | | | | | | Added -system-headers option to allow display of warnings from system headers. This is needed for testing libcxx, for example. llvm-svn: 220826
* Add flag --enable-check-profile to clang-tidy.Samuel Benzaquen2014-10-231-1/+6
| | | | | | | | | | | | | | | 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 llvm-svn: 220491
* Implemented clang-tidy configurability via .clang-tidy files.Alexander Kornienko2014-09-041-5/+9
| | | | | | | | | | | | | | | | | 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
* Rename ChecksFilter to GlobList, as there's nothing specific to checks in it.Alexander Kornienko2014-08-061-15/+15
| | | | | | | | | | | | | | | | | | 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
* Set up clang-tidy diagnostic consumer to print types etc.Alexander Kornienko2014-07-141-0/+5
| | | | | | | | | | | | Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4494 llvm-svn: 212941
* Consistently handle clang-tidy check names in ClangTidyError.Alexander Kornienko2014-07-021-1/+27
| | | | | | | | | | | | | | | | | | | Summary: This patch removes " [check-name]" from the end of ClangTidyMessage::Message. The " [check-name]" part is only appended when printing diagnostics on the console. Clang errors are now marked with "clang-diagnostic-error" check name, remarks and unknown warnings are marked with "clang-diagnostic-unknown". Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4356 llvm-svn: 212180
* Initialize ClangTidyMessage::FileOffset field to avoid unitialized variable ↵Alexander Kornienko2014-06-301-1/+2
| | | | | | access when sorting errors on output. llvm-svn: 212042
* Track changes from clang r211448.Alp Toker2014-06-211-4/+0
| | | | llvm-svn: 211450
* Allow per-file clang-tidy options.Alexander Kornienko2014-06-051-9/+43
| | | | | | | | | | | | | | | | | | 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
* Never filter-out compile errors in clang-tidy, display them as errors.Alexander Kornienko2014-06-021-3/+13
| | | | | | | | | | | | | | | | | | Summary: No filters should affect the display of errors. Fixed a few tests, which had compile errors. We need to think what we should do with mapped errors (-Werror). Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3982 llvm-svn: 210044
* Update the code according to the changes in r209468.Alexander Kornienko2014-05-221-4/+2
| | | | llvm-svn: 209470
* Add clang-tidy -line-filter option to filter findings by line ranges.Alexander Kornienko2014-05-221-12/+42
| | | | | | | | | | | | | | | | | 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
* Fixed incorrect StringRef::find usage.Alexander Kornienko2014-05-151-1/+1
| | | | llvm-svn: 208898
* Change the behavior of clang-tidy -checks=, remove -disable-checks.Alexander Kornienko2014-05-151-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update for Clang API change and move ClangTidyDiagnosticRenderer into an ↵Benjamin Kramer2014-05-101-8/+7
| | | | | | anonymous namespace while there. llvm-svn: 208471
* Store Errors inside ClangTidyContext instead of just pointer to an externalAlexander Kornienko2014-05-091-4/+4
| | | | | | | | | | | | | | | 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
* Print stats on displayed and ignored warnings.Alexander Kornienko2014-05-071-11/+19
| | | | | | | | | | | | | | | | 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 llvm-svn: 208174
* Fix a crash when diagnostic points to a macro definition on command line.Alexander Kornienko2014-05-061-1/+4
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3620 llvm-svn: 208068
* Add clang-tidy -header-filter optionAlexander Kornienko2014-05-051-4/+23
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 207970
* Add ClangTidyOptions to encapsulate all clang-tidy options.Alexander Kornienko2014-04-291-7/+6
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3544 llvm-svn: 207532
* Output clang-tidy errors in a consistent order.Alexander Kornienko2014-04-081-3/+4
| | | | | | | | | | | | | | 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
* ClangTidyContext: Don't use initializer on non-static member.NAKAMURA Takumi2014-03-201-1/+2
| | | | llvm-svn: 204333
* Post-filter clang-tidy diagnostic messages.Alexander Kornienko2014-03-201-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Use DiagnosticRenderer to convert clang diagnostics to clang-tidy ones.Alexander Kornienko2014-03-101-36/+92
| | | | | | | | | | | | | | | | Summary: This is immediately useful for generating macro expansion notes, and may be useful for other things later on. Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2950 llvm-svn: 203457
* Deduplicate clang-tidy error messages by file, offset and message.Alexander Kornienko2014-03-101-2/+18
| | | | | | | | | | | | | | Summary: Peter, I guess, this can help you in testing your check. Reviewers: djasper, pcc, klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2989 llvm-svn: 203451
* Use range-based for loops for better readability. No functional changes ↵Alexander Kornienko2014-03-061-2/+2
| | | | | | | | | | | | | | intended. Reviewers: chandlerc Reviewed By: chandlerc CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2979 llvm-svn: 203101
* Fixed a crash when handling diagnostics without a valid file location, e.g. ↵Alexander Kornienko2014-03-051-5/+9
| | | | | | 'error reading <file>'. llvm-svn: 202987
* [cleanup] Re-sort headers with llvm/utils/sort_includes.py.Chandler Carruth2014-03-041-1/+0
| | | | llvm-svn: 202809
* Added a naive NOLINT implementation.Alexander Kornienko2014-02-281-1/+14
| | | | | | | | | | | | | | | | Summary: Added a naive NOLINT implementation. It doesn't care about specific linter categories, just the "// NOLINT" on the same line as a diagnostic. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2896 llvm-svn: 202452
* Improve clang-tidy diagnostic output and filtering.Alexander Kornienko2014-02-061-18/+25
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces several improvements to clang-tidy diagnostic; 1. Make filtering of messages from non-user code more reliable. Output an error when it or any of the related notes touches user code. This fixes an assertion when an error has a location in a system header, and one of the notes relates to user code. 2. In order for 1. to work, subscribe to the static analyzer diagnostics using a custom PathDiagnosticConsumer. 3. Enable colors on supported terminals. 4. Output FixItHints. Reviewers: djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2714 llvm-svn: 200924
* Fix crash when handling an argument parsing-related warning.Alexander Kornienko2014-02-031-1/+3
| | | | | | | | | | | | | | Summary: Don't crash on warnings coming before the translation unit starts. Reviewers: klimek, djasper Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2676 llvm-svn: 200702
* Fix another invalid getCustomDiagID() use to unbreak the buildAlp Toker2014-01-261-3/+3
| | | | | | | | It was calling the utility wrapper that now requires a constant string following clang r200132. The StringRef version on DiagnosticIDs appears to have been what was intended so change to that. llvm-svn: 200142
* Add the check name to the clang-tidy diagnostic output.Alexander Kornienko2014-01-131-6/+20
| | | | | | | | | | | | | | | | | Summary: Pass check names all the way from ClangTidyModule through ClangTidyCheck and ClangTidyContext to ClangTidyError, and output it in handleErrors. This allows to find mis-behaving check and disable it easily. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2534 llvm-svn: 199094
* Re-applied r198807, r198808 with an additional change to fix linking in ↵Alexander Kornienko2014-01-091-0/+117
| | | | | | configure Release+Asserts build. llvm-svn: 198875
* Reverted r198807, r198808, as they cause link errors in configure builds. ↵Alexander Kornienko2014-01-091-117/+0
| | | | | | Will look at this later. llvm-svn: 198832
* Updated file comment.Alexander Kornienko2014-01-081-2/+3
| | | | llvm-svn: 198808
* Restructured code, no functional changes.Alexander Kornienko2014-01-081-0/+116
Summary: Moved implementation of classes declared in ClangTidyDiagnosticConsumer.h to ClangTidyDiagnosticConsumer.cpp. Added a FIXME note in ClangTidyDiagnosticConsumer::HandleDiagnostic. Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2520 llvm-svn: 198807
OpenPOWER on IntegriCloud