Commit Graph

535 Commits

Author SHA1 Message Date
Manuel Klimek 5a1ef9c855 Fix clang-query on Windows: flush llvm::outs() after each command.
llvm-svn: 209313
2014-05-21 18:10:47 +00:00
Alexander Kornienko 16ff5c71ba Added a comment
llvm-svn: 209146
2014-05-19 17:46:28 +00:00
Alexander Kornienko bef51cdf05 Improved llvm-namespace-comment check.
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
2014-05-19 16:39:08 +00:00
Daniel Jasper 993a906af3 Address review comments on r208954. No functional changes.
llvm-svn: 209111
2014-05-19 07:23:03 +00:00
Alp Toker 124084e238 Track clang changes from r209061
llvm-svn: 209062
2014-05-17 04:54:13 +00:00
NAKAMURA Takumi 81774baf4d Initializer list is unavailable. Use the constructor instead.
llvm-svn: 208986
2014-05-16 13:37:20 +00:00
NAKAMURA Takumi 2dd94635d4 clang-tidy/misc/UseOverride.cpp: Appease targeting msvc.
With IsLateTemplateParsed, FunctionDecl::doesThisDeclarationHaveABody() returns True regardless of Body.

llvm-svn: 208985
2014-05-16 13:37:08 +00:00
Alexander Kornienko 3ab3467cef Update clang-tidy documentation.
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
2014-05-16 13:07:18 +00:00
Daniel Jasper 2378ebd537 Initial version of clang-tidy check to use override instead of virual.
Review: http://reviews.llvm.org/D3688
llvm-svn: 208954
2014-05-16 09:30:09 +00:00
Alexander Kornienko 6262d2349c Fixed incorrect StringRef::find usage.
llvm-svn: 208898
2014-05-15 15:56:58 +00:00
Alexander Kornienko 23fe95904c Change the behavior of clang-tidy -checks=, remove -disable-checks.
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
2014-05-15 14:27:36 +00:00
Benjamin Kramer 281f9d0e97 Update for Clang API change and move ClangTidyDiagnosticRenderer into an anonymous namespace while there.
llvm-svn: 208471
2014-05-10 16:32:07 +00:00
Alexander Kornienko c0093609b0 Allow ClangTidyDiagnosticConsumer to be reused.
llvm-svn: 208420
2014-05-09 15:50:15 +00:00
Alexander Kornienko 826b5adb6c Store Errors inside ClangTidyContext instead of just pointer to an external
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
2014-05-09 12:24:09 +00:00
Alexander Kornienko 5d174547a9 Print stats on displayed and ignored warnings.
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
2014-05-07 09:06:53 +00:00
Alexander Kornienko 238795e9c6 Fix a crash when diagnostic points to a macro definition on command line.
Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3620

llvm-svn: 208068
2014-05-06 08:10:00 +00:00
Alexander Kornienko 4aab579d07 Fix assertion in google-explicit-constructor check when the constructor is
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
2014-05-05 18:49:31 +00:00
Alexander Kornienko 9ff5b6f3ca Add clang-tidy -header-filter option
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
2014-05-05 14:54:47 +00:00
Alex McCarthy 3b510bc43d Fix ClangTidyOptions constructor to initialize all members. Fixes bug introduced in r207652.
Reviewers: rsmith

Subscribers: cfe-commits, alexfh, klimek

Differential Revision: http://reviews.llvm.org/D3578

llvm-svn: 207715
2014-04-30 22:32:51 +00:00
Alex McCarthy 8f877cbe5c Test cleanup recommended in http://reviews.llvm.org/D3556
llvm-svn: 207653
2014-04-30 14:18:41 +00:00
Alex McCarthy fec08c72be Add a clang-tidy flag to support temporary destructor-aware analysis (workaround for bug 15599).
Reviewers: alexfh

Subscribers: jordan_rose, klimek, djasper, cfe-commits

Differential Revision: http://reviews.llvm.org/D3556

llvm-svn: 207652
2014-04-30 14:09:24 +00:00
Alexander Kornienko 3b26849f38 Fix the message for "Move constructor declared explicit".
Make the tests for removal of 'explicit' more diverse.

llvm-svn: 207534
2014-04-29 15:50:14 +00:00
Alexander Kornienko 33a9bcce29 Add ClangTidyOptions to encapsulate all clang-tidy options.
Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3544

llvm-svn: 207532
2014-04-29 15:20:10 +00:00
Alexander Kornienko 014225e11e Warn on explicit copy constructors.
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
2014-04-29 15:07:08 +00:00
Samuel Benzaquen 20e93f39c1 Do not touch get() calls on 'this' object.
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
2014-04-29 13:41:23 +00:00
Alex McCarthy 5bc902e8e1 Fix typo (first commit to test commit access).
llvm-svn: 207490
2014-04-29 02:33:58 +00:00
Benjamin Kramer fb68e640d2 Try to fix the build. newFrontendActionFactory was changed to return a unique_ptr.
llvm-svn: 207407
2014-04-28 10:06:50 +00:00
Alexander Kornienko 6774c87a8a Now with correct -disable-checks=
llvm-svn: 207364
2014-04-27 15:37:29 +00:00
Alexander Kornienko 634d95d58f Specify checks in a more reliable way.
llvm-svn: 207363
2014-04-27 15:27:28 +00:00
Alexander Kornienko ec0bd807a4 Allow clang-tidy tests with any file names.
llvm-svn: 207353
2014-04-27 11:44:21 +00:00
David Blaikie 25286a51b1 Remove unnecessary explicit unique_ptr ctors now that buildASTFromCode returns a unique_ptr instead of a raw pointer.
llvm-svn: 207238
2014-04-25 17:03:20 +00:00
David Blaikie 35013fa390 Slightly less blindly fixing clang-tools-extra now that I remember that the "check-clang" target doesn't check clang-tools-extra
llvm-svn: 207231
2014-04-25 15:21:43 +00:00
David Blaikie 329be894f1 Blindly try to fix the clang-tools-extra build since my local build doesn't appear to be picking it up
llvm-svn: 207230
2014-04-25 15:06:18 +00:00
NAKAMURA Takumi d6aa8f435b QueryEngineTest.cpp: Appease g++47.
llvm-svn: 207097
2014-04-24 11:02:17 +00:00
NAKAMURA Takumi be6b63b685 ClangQueryTests: Fix msc17 build. Non-static member initializers are unavailable.
llvm-svn: 207096
2014-04-24 10:58:17 +00:00
NAKAMURA Takumi fcb3fa13c4 QueryParser::doParse(): Fix msc17 build. Don't use initializer list.
llvm-svn: 206998
2014-04-23 16:01:44 +00:00
Samuel Benzaquen 1f6066c9ac Add new 'let' command to bind arbitrary values into constants.
Summary:
Add new 'let' command to bind arbitrary values into constants.
These constants can then be used in the matcher expressions.

Reviewers: pcc

CC: cfe-commits

Differential Revision: http://reviews.llvm.org/D3383

llvm-svn: 206984
2014-04-23 14:04:52 +00:00
NAKAMURA Takumi 951716bf37 test/clang-tidy/redundant-smartptr-get*.cpp: Both of them really require shell.
llvm-svn: 205951
2014-04-10 03:17:22 +00:00
Samuel Benzaquen fec969a0af Inject unique_ptr/shared_ptr into the test instead of using <memory>
Summary:
Inject unique_ptr/shared_ptr into the test instead of using <memory>
Libraries might not be present on tests.
This fixes the break introduces at rL205854.

Reviewers: klimek

CC: cfe-commits

Differential Revision: http://reviews.llvm.org/D3330

llvm-svn: 205913
2014-04-09 16:50:38 +00:00
Samuel Benzaquen 110f3cc45a Extend the check to detect patterns like 'ptr.get() == nullptr'
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
2014-04-09 14:17:23 +00:00
Alexander Kornienko 9eb8c92b52 Output clang-tidy errors in a consistent order.
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
2014-04-08 12:27:49 +00:00
Manuel Klimek 8fae8ddab8 Update arc config to new domain.
llvm-svn: 205703
2014-04-07 10:23:19 +00:00
Daniel Jasper 7b8d263998 Fix regex bug in clang-tidy.
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
2014-04-02 08:52:06 +00:00
Daniel Jasper a3b8f0cf7d Disable a few clang-tidy checks by default.
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
2014-04-02 08:27:12 +00:00
Guillaume Papin 46113d0e22 clang-modernize: fix invalid assignment in findClangApplyReplacements()
Summary:
When clang-apply-replacements wasn't in the PATH or sitting next to
clang-modernize, findClangApplyReplacements() was finding the wrong path
(pointing to clang-modernize instead of nothing).

See the related PR at http://llvm.org/bugs/show_bug.cgi?id=18421

Reviewers: klimek

CC: silvas, cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3217

llvm-svn: 205136
2014-03-30 10:50:25 +00:00
Samuel Benzaquen 3a571019c8 Add clang-tidy check to remove redundant .get() calls on smart pointers.
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
2014-03-27 17:42:26 +00:00
NAKAMURA Takumi 4dd1813043 ClangTidy.cpp: Don't use non-static member initializer, for msc17.
llvm-svn: 204931
2014-03-27 14:53:37 +00:00
Alexander Kornienko 38d81b41eb Output messages when clang-tidy applies fix-its.
Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3192

llvm-svn: 204909
2014-03-27 10:24:11 +00:00
Alexander Kornienko 3c598d39cd Removed unused include
llvm-svn: 204551
2014-03-23 00:32:18 +00:00
NAKAMURA Takumi 338eee1964 ClangTidyContext: Don't use initializer on non-static member.
llvm-svn: 204333
2014-03-20 10:53:03 +00:00