summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Renamed runClangTidy argument Ranges to InputFiles, removed a TODO comment.Alexander Kornienko2014-05-282-5/+3
| | | | | | No functional changes. llvm-svn: 209743
* clang-tidy: Only add 'override' before inlined bodies.Daniel Jasper2014-05-231-1/+2
| | | | llvm-svn: 209505
* 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-226-22/+169
| | | | | | | | | | | | | | | | | 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
* Added a commentAlexander Kornienko2014-05-191-0/+2
| | | | llvm-svn: 209146
* Improved llvm-namespace-comment check.Alexander Kornienko2014-05-197-75/+202
| | | | | | | | | | | | | | | | | | | 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
* Address review comments on r208954. No functional changes.Daniel Jasper2014-05-191-7/+6
| | | | llvm-svn: 209111
* Track clang changes from r209061Alp Toker2014-05-171-2/+1
| | | | llvm-svn: 209062
* Initializer list is unavailable. Use the constructor instead.NAKAMURA Takumi2014-05-161-2/+3
| | | | llvm-svn: 208986
* clang-tidy/misc/UseOverride.cpp: Appease targeting msvc.NAKAMURA Takumi2014-05-161-1/+1
| | | | | | With IsLateTemplateParsed, FunctionDecl::doesThisDeclarationHaveABody() returns True regardless of Body. llvm-svn: 208985
* Update clang-tidy documentation.Alexander Kornienko2014-05-161-19/+24
| | | | | | | | | | | | | | | | 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 llvm-svn: 208979
* Initial version of clang-tidy check to use override instead of virual.Daniel Jasper2014-05-164-0/+165
| | | | | Review: http://reviews.llvm.org/D3688 llvm-svn: 208954
* 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-154-27/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Allow ClangTidyDiagnosticConsumer to be reused.Alexander Kornienko2014-05-091-0/+1
| | | | llvm-svn: 208420
* Store Errors inside ClangTidyContext instead of just pointer to an externalAlexander Kornienko2014-05-095-16/+16
| | | | | | | | | | | | | | | 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-075-21/+70
| | | | | | | | | | | | | | | | 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
* Fix assertion in google-explicit-constructor check when the constructor isAlexander Kornienko2014-05-051-3/+5
| | | | | | | | | | | | | | | | | | 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
* Add clang-tidy -header-filter optionAlexander Kornienko2014-05-054-6/+40
| | | | | | | | | | | | | | | | | | 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
* Fix ClangTidyOptions constructor to initialize all members. Fixes bug ↵Alex McCarthy2014-04-301-1/+1
| | | | | | | | | | | | introduced in r207652. Reviewers: rsmith Subscribers: cfe-commits, alexfh, klimek Differential Revision: http://reviews.llvm.org/D3578 llvm-svn: 207715
* Add a clang-tidy flag to support temporary destructor-aware analysis ↵Alex McCarthy2014-04-304-13/+30
| | | | | | | | | | | | (workaround for bug 15599). Reviewers: alexfh Subscribers: jordan_rose, klimek, djasper, cfe-commits Differential Revision: http://reviews.llvm.org/D3556 llvm-svn: 207652
* Fix the message for "Move constructor declared explicit".Alexander Kornienko2014-04-291-1/+2
| | | | | | Make the tests for removal of 'explicit' more diverse. llvm-svn: 207534
* Add ClangTidyOptions to encapsulate all clang-tidy options.Alexander Kornienko2014-04-296-22/+49
| | | | | | | | | | | | 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-3/+46
| | | | | | | | | | | | | | | | | 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
* Do not touch get() calls on 'this' object.Samuel Benzaquen2014-04-291-0/+1
| | | | | | | | | | | | | | | | Summary: These calls are part of the implementation of the smart pointer itself and chaning it is likely to be wrong. Example: T& operator*() const { return *get(); } Reviewers: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3540 llvm-svn: 207525
* Fix typo (first commit to test commit access).Alex McCarthy2014-04-291-1/+1
| | | | llvm-svn: 207490
* Extend the check to detect patterns like 'ptr.get() == nullptr'Samuel Benzaquen2014-04-091-23/+55
| | | | | | | | | | | | | | | | | Summary: Extend the check to detect patterns like 'ptr.get() == nullptr' It detects == and != when any argument is a ptr.get() and the other is a nullptr. Only supports standard smart pointer types std::unique_ptr and std::shared_ptr. Does not support the case 'ptr.get() == other.get()' yet. Reviewers: djasper CC: cfe-commits, alexfh Differential Revision: http://llvm-reviews.chandlerc.com/D3294 llvm-svn: 205854
* 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
* Fix regex bug in clang-tidy.Daniel Jasper2014-04-021-1/+1
| | | | | | | | 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. llvm-svn: 205408
* Disable a few clang-tidy checks by default.Daniel Jasper2014-04-021-1/+5
| | | | | | | | 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. llvm-svn: 205407
* Add clang-tidy check to remove redundant .get() calls on smart pointers.Samuel Benzaquen2014-03-274-3/+130
| | | | | | | | | | | | | | | Summary: This check finds and removes redundant .get() calls on smart pointers. Example: ptr.get()->Foo() ==> ptr->Foo() Reviewers: alexfh CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3186 llvm-svn: 204947
* ClangTidy.cpp: Don't use non-static member initializer, for msc17.NAKAMURA Takumi2014-03-271-3/+3
| | | | llvm-svn: 204931
* Output messages when clang-tidy applies fix-its.Alexander Kornienko2014-03-271-49/+85
| | | | | | | | | | | | Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3192 llvm-svn: 204909
* ClangTidyContext: Don't use initializer on non-static member.NAKAMURA Takumi2014-03-202-2/+3
| | | | llvm-svn: 204333
* clang-tidy explicit constructor check: don't warn on copy or move constructors.Alexander Kornienko2014-03-201-1/+1
| | | | | | | | | | | | | | | | | 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-205-42/+57
| | | | | | | | | | | | | | | | | | | | | | | | 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-191-1/+2
| | | | | | | | | | | | Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3116 llvm-svn: 204226
* clang-tidy/ArgumentCommentCheck: Initializer list in non-static members is ↵NAKAMURA Takumi2014-03-182-1/+6
| | | | | | unavailable on msc17. llvm-svn: 204121
* Add an argument comment checker to clang-tidy.Peter Collingbourne2014-03-184-0/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use DiagnosticRenderer to convert clang diagnostics to clang-tidy ones.Alexander Kornienko2014-03-102-39/+93
| | | | | | | | | | | | | | | | 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
* [C++11] Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-093-3/+3
| | | | | | | | 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
* Use the appropriate operator<< instead of addRanges.Alexander Kornienko2014-03-061-14/+6
| | | | llvm-svn: 203118
* Use range-based for loops for better readability. No functional changes ↵Alexander Kornienko2014-03-063-76/+49
| | | | | | | | | | | | | | 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
* Added a module for checks not related to LLVM or Google coding style.Alexander Kornienko2014-03-058-5/+65
| | | | llvm-svn: 202970
* Fixed formatting.Alexander Kornienko2014-03-056-13/+6
| | | | llvm-svn: 202969
* [cleanup] Re-sort headers with llvm/utils/sort_includes.py.Chandler Carruth2014-03-041-1/+0
| | | | llvm-svn: 202809
OpenPOWER on IntegriCloud