Commit Graph

578 Commits

Author SHA1 Message Date
Alexander Kornienko 94a656477d Initialize ClangTidyMessage::FileOffset field to avoid unitialized variable access when sorting errors on output.
llvm-svn: 212042
2014-06-30 14:29:03 +00:00
Alexander Kornienko e3b7839bfc Added a comment to document relation of this check to -Wold-style-cast.
llvm-svn: 212033
2014-06-30 09:54:12 +00:00
Alexander Kornienko 276fc642d3 Another attempt to add a clang-tidy check for flagging C-style casts.
Summary:
The first version failed the SubstNonTypeTempateParmExpr-related test
on some buildbots. This one uses the new substNonTypeTempateParmExpr matcher to
filter out implicit C-style casts.

This patch depends on D4327.

Reviewers: djasper

Reviewed By: djasper

Subscribers: aemerson, cfe-commits

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

llvm-svn: 212002
2014-06-29 22:19:53 +00:00
NAKAMURA Takumi 360096e701 Make clang-tidy-diff.py py3-compatible.
llvm-svn: 211834
2014-06-27 01:10:18 +00:00
NAKAMURA Takumi 25dadfd2a8 Suppress clang-tools-extra/test/clang-tidy/clang-tidy-diff.cpp on win32 due to dos path issue.
I'll fix it later.

llvm-svn: 211831
2014-06-27 00:55:16 +00:00
Alexander Kornienko 47e8e72a80 Make the clang-tidy-diff.py test conditional on the presence of Python 2.7. Use the python binary from the configuration.
llvm-svn: 211789
2014-06-26 16:32:26 +00:00
NAKAMURA Takumi 2d8dcc5bd1 Suppress clang-tidy-diff.py. It is incompatible to py26 due to argparse.
llvm-svn: 211741
2014-06-25 23:13:34 +00:00
Alexander Kornienko cd11179374 Rolling back, as the test fails on one of the buildbots:
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/13505/steps/check-all/logs/Clang%20Tools%3A%3Ac-style-casts.cpp

llvm-svn: 211708
2014-06-25 15:33:35 +00:00
Alexander Kornienko a9b7ec18f1 Apparently, some versions of diff like -U0 more than -u0.
llvm-svn: 211703
2014-06-25 14:56:58 +00:00
Alexander Kornienko 73ba424506 Add a check to flag the usage of C-style casts (Google Style).
Summary:
Add a check to flag the usage of C-style casts, as per Google Style
Guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211702
2014-06-25 14:52:44 +00:00
Alexander Kornienko 1de35e719f Add clang-tidy-diff.py script to run clang-tidy and display warnings on changed lines only.
Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211698
2014-06-25 14:09:52 +00:00
Alp Toker b5fbfa2bab Track changes from clang r211448.
llvm-svn: 211450
2014-06-21 23:33:00 +00:00
Daniel Jasper 024ebf4a65 clang-tidy: [misc-use-override] Correctly handle defaulted destructors.
Also, minor implementation and test fixes.

llvm-svn: 211345
2014-06-20 09:12:46 +00:00
David Blaikie 92fc741998 Unbreak the build after r211244.
These operator overloads were unneeded (once the const correctness in
PooledStringPtr was corrected) and inefficient (since the strings are
pooled the pointers can just be compared for equality instead of doing
strcmp).

llvm-svn: 211245
2014-06-19 00:43:19 +00:00
Alexander Kornienko 72f1e754a7 Move google-explicit-constructor check to a separate source file.
Summary: No functional changes.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211154
2014-06-18 09:33:46 +00:00
Rafael Espindola c7f0d23f56 Prefix error_code with std.
llvm-svn: 210840
2014-06-12 22:08:48 +00:00
Rafael Espindola 002840cf66 Quick build fix.
llvm-svn: 210838
2014-06-12 22:01:48 +00:00
Rafael Espindola fd85bb3424 include system_error directly.
llvm-svn: 210797
2014-06-12 16:53:02 +00:00
Rafael Espindola 15c5784d3c Replace llvm::error_code with std::error_code.
llvm-svn: 210776
2014-06-12 13:32:11 +00:00
Alexander Kornienko 3095b420f4 A follow-up to r210260: updated a comment. No functional changes.
llvm-svn: 210767
2014-06-12 11:25:45 +00:00
Alp Toker f77acce059 Track clang changes from r210758
llvm-svn: 210759
2014-06-12 10:16:11 +00:00
Rafael Espindola d9ba837bfd Use generic_category from the std namespace.
llvm-svn: 210735
2014-06-12 01:57:33 +00:00
Daniel Jasper 05bdb09da1 clang-tidy: [use-override] Remove 'override' if 'final' is also present.
Also, make warning more precise by distinguishing different cases.

llvm-svn: 210651
2014-06-11 12:18:24 +00:00
Alp Toker 9d63b5eb7f Prospective build fix following clang r210518
llvm-svn: 210521
2014-06-10 09:58:45 +00:00
Craig Topper 6014c49921 Simplify code. No functional change.
llvm-svn: 210508
2014-06-10 04:50:50 +00:00
Craig Topper f61be9c971 [C++11] Use 'nullptr'.
llvm-svn: 210447
2014-06-09 02:03:06 +00:00
Alexander Kornienko a46952221e Allow per-file clang-tidy options.
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
2014-06-05 13:31:45 +00:00
Daniel Jasper c0a3fa977d clang-tidy: Make use-override tests stricter.
As per post review comment.

llvm-svn: 210173
2014-06-04 08:47:25 +00:00
Daniel Jasper 0ab7902755 clang-tidy use override: Don't generate incorrect warnings without fixes
Add basic testing for the emitted diagnostics.

llvm-svn: 210171
2014-06-04 08:26:02 +00:00
Alp Toker f88da971e5 Remove inclusions of LLVM's private config.h
llvm-svn: 210146
2014-06-04 03:34:26 +00:00
Rafael Espindola f145137516 Don't assume an implicit error_code -> bool operator.
llvm-svn: 210070
2014-06-03 04:40:55 +00:00
Alexander Kornienko 348cae8e2b Never filter-out compile errors in clang-tidy, display them as errors.
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
2014-06-02 20:44:32 +00:00
Alexander Kornienko fbf9258582 Exit with error when no checks enabled.
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

llvm-svn: 210043
2014-06-02 20:32:06 +00:00
Daniel Jasper 88996755cb clang-tidy: Extend the use-override check to understand 'final'.
llvm-svn: 210031
2014-06-02 15:22:22 +00:00
Rafael Espindola 228166a4ca Use error_code() instead of error_code::succes()
There is no std::error_code::success, so this removes much of the noise
in transitioning to std::error_code.

llvm-svn: 209953
2014-05-31 02:00:59 +00:00
Daniel Jasper a2332425c4 Revert "Remove redundant check discovered in post-commit review of r209505."
This breaks with MSVC.
With IsLateTemplateParsed, FunctionDecl::doesThisDeclarationHaveABody() returns true regardless of Body.

This reinstates what was fixed in r208985.

llvm-svn: 209896
2014-05-30 13:31:14 +00:00
Daniel Jasper 5070c18928 Remove redundant check discovered in post-commit review of r209505.
llvm-svn: 209882
2014-05-30 09:21:17 +00:00
Alexander Kornienko 1e1ad5cf9c Renamed runClangTidy argument Ranges to InputFiles, removed a TODO comment.
No functional changes.

llvm-svn: 209743
2014-05-28 15:21:14 +00:00
NAKAMURA Takumi 98247b3a75 ClangTidyOptionsTest.cpp: Rewrite literals. Raw string literals are unavailable on msc17.
llvm-svn: 209583
2014-05-24 17:22:01 +00:00
NAKAMURA Takumi f6a37d396c clang-tools-extra/test/clang-tidy/line-filter.cpp: Tweak line-filter.
On win32, %s is expanded to X:\path\to\test\line-filter.cpp. It was incompatible to yaml.
Although "%/s" could be available in Lit, ClangTidyDiagnosticConsumer::passesLineFilter() is unaware of comparision between '/' and '\\'.

llvm-svn: 209569
2014-05-24 08:42:12 +00:00
Daniel Jasper 39f9f726bc clang-tidy: Only add 'override' before inlined bodies.
llvm-svn: 209505
2014-05-23 08:52:10 +00:00
Alexander Kornienko e1f62eca2d Update the code according to the changes in r209468.
llvm-svn: 209470
2014-05-22 20:19:46 +00:00
Alexander Kornienko dad4acbc52 Add clang-tidy -line-filter option to filter findings by line ranges.
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
2014-05-22 16:07:11 +00:00
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