Commit Graph

1065 Commits

Author SHA1 Message Date
Aaron Ballman ec3e5d6fd8 Disable clang-tidy Google checkers when not compiling in C++ mode. None of the checkers require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct.
llvm-svn: 246663
2015-09-02 16:20:42 +00:00
Aaron Ballman 1f1b067036 Disable clang-tidy readability checkers when not compiling in C++ mode. None of the checkers require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct.
llvm-svn: 246661
2015-09-02 16:05:21 +00:00
Aaron Ballman 01cee3a7bd Move some more functionality into the AST consumer creation factory function, before registering matchers with the MatchFinder object. This allows us to set the language options for the ClangTidyContext object appropriately so that they can be used from registerMatchers(), and more closely models the way the clang-tidy tool works.
llvm-svn: 246660
2015-09-02 16:04:15 +00:00
Angel Garcia Gomez 8475466860 Fix loop-convert crash.
Summary: loop-convert no longer crashes when calling a member function using a member pointer which is a member of another record.

Reviewers: alexfh, klimek

Subscribers: cfe-commits, klimek

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

llvm-svn: 246655
2015-09-02 14:25:08 +00:00
Alexander Kornienko 84745524b3 [clang-tidy] Updated the check name in the doc.
llvm-svn: 246643
2015-09-02 12:01:51 +00:00
Angel Garcia Gomez e6035de11e Fix use-auto-check.
Summary: Fix a bug where use-auto check would crash when the definition of a type is in the same statement than its instantiation with new.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

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

llvm-svn: 246638
2015-09-02 10:20:00 +00:00
Yaron Keren 95e6d9ebbd Add \n to the regex in clang-tidy-diff.py in order to fix http://llvm.org/PR24637,
git usecase for multiple files diff.

llvm-svn: 246575
2015-09-01 19:08:17 +00:00
Angel Garcia Gomez 692cbb5bb0 Fix several corner cases for loop-convert check.
Summary: Reduced the amount of wrong conversions of this check.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 246550
2015-09-01 15:05:15 +00:00
Aaron Ballman c0dc76c251 Allow the static assert clang-tidy checker to run over C code.
llvm-svn: 246495
2015-08-31 21:54:42 +00:00
Aaron Ballman f444177d00 Help the clang-tidy helper script to understand C files better.
llvm-svn: 246494
2015-08-31 21:53:55 +00:00
Aaron Ballman bf89109013 Using an early return as it is more clear; NFC.
llvm-svn: 246447
2015-08-31 15:28:57 +00:00
Alexander Kornienko 54f3657448 [clang-tidy] misc-assert-side-effect: support assert macros defined through other macros
llvm-svn: 246446
2015-08-31 14:47:14 +00:00
Aaron Ballman a96b33b1b1 Using an early return as it is more clear; NFC.
llvm-svn: 246444
2015-08-31 14:23:21 +00:00
Alexander Kornienko 0ed6c478a4 [clang-tidy] Move misc-use-override and readability-shrink-to-fit to "modernize/"
These checks are focusing on migrating the code from C++98/03 to C++11, so they
belong to the modernize module.

llvm-svn: 246437
2015-08-31 13:17:43 +00:00
Aaron Ballman ed5e4ef853 Updated to make use of the AST matcher instead of a custom matcher; NFC.
llvm-svn: 246325
2015-08-28 19:40:30 +00:00
Aaron Ballman 327e97bb37 Disable clang-tidy misc checkers when not compiling in C++ mode. Many of the checkers do not require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct.
llvm-svn: 246318
2015-08-28 19:27:19 +00:00
Aaron Ballman 8b0583ef1b Disable several more clang-tidy modernize checkers when not compiling in C++ mode. Loop conversion would make recommendations for C code, so added a test to ensure that does not happen. The pass by value, use auto and replace auto_ptr checkers would not make recommendations for C code, and are disabled for performance reasons, but do not require an extra test.
llvm-svn: 246310
2015-08-28 17:58:10 +00:00
Aaron Ballman f36a425eba Reapplying r246209, which exposed language options to the checkers. This 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
2015-08-28 13:20:46 +00:00
Alexander Kornienko f0fa8a80a3 [clang-tidy] Documented the reason to run the test in C++98 mode.
llvm-svn: 246238
2015-08-27 23:43:39 +00:00
Aaron Ballman 46c9ae3578 Reverting r246209 while I investigate a build bot failure: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516
llvm-svn: 246224
2015-08-27 22:19:50 +00:00
Aaron Ballman ed916fa458 Expose language options to the checkers; disable UseNullptrCheck when not compiling in C++11 mode.
llvm-svn: 246209
2015-08-27 21:17:47 +00:00
Alexander Kornienko aabfadef84 [clang-tidy] Move clang-tidy docs to a separate directory. Create doc files for checks
The doc files for checks have been generated from the corresponding header files
using the docs/clang-tidy/tools/dump_check_docs.py script. Committing the script
as well, but the intention is to move all the user-facing docs from header files
to the rST files and add links to .h files appropriately.

llvm-svn: 246173
2015-08-27 18:10:07 +00:00
Alexander Kornienko 2588cb93af [clang-tidy] Renamed a test file to <check-name>.cpp.
llvm-svn: 246170
2015-08-27 18:03:37 +00:00
Alexander Kornienko f8ed0a8d35 [clang-tidy] Update docs for clang-tidy checks. NFC
Changes mostly address formatting and unification of the style. Use
MarkDown style for inline code snippets and lists. Added some text
for a few checks.

The idea is to move most of the documentation out to separate rST files and have
implementation files refer to the corresponding documentation files.

llvm-svn: 246169
2015-08-27 18:01:58 +00:00
Angel Garcia Gomez 8409e88fde Fix another LoopConvert fail.
Summary: Prevent LoopConvert from taking as alias anything that comes from a random member function call.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 246039
2015-08-26 17:08:24 +00:00
Angel Garcia Gomez 446fe8d62c LoopConvert no longer take as alias references to other containers.
Summary: Fix a bug where modernize-loop-convert check would take as alias a reference to other containers. Add the pertinent test.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 246034
2015-08-26 14:51:11 +00:00
Angel Garcia Gomez 06d010cae3 Avoid LoopConvertCheck replacements in template instantiations.
Summary: Prevent LoopConvertCheck from doing replacements in template instantiations, and add a test.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 245942
2015-08-25 15:44:00 +00:00
Angel Garcia Gomez 190167104c Add replace-auto_ptr check.
Summary: Migrate replace-auto_ptr check from clang-modernize to modernize module in clang-tidy.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 245933
2015-08-25 13:03:43 +00:00
Angel Garcia Gomez df21015903 Tests no longer need the 'REQUIRES: SHELL' line.
Summary: Update python script, so that it doesn't print that line in new tests.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 245926
2015-08-25 08:39:34 +00:00
Angel Garcia Gomez 5b9d33a5a1 [clang-tidy] Migrate UseAuto from clang-modernize to clang-tidy.
http://reviews.llvm.org/D12231

llvm-svn: 245703
2015-08-21 15:08:51 +00:00
Angel Garcia Gomez 485f38756d Test commit!
llvm-svn: 245701
2015-08-21 13:55:16 +00:00
Alexander Kornienko 36c8e56493 [clang-tidy] Remove check_clang_tidy.sh that has been replaced with check_clang_tidy.py.
llvm-svn: 245699
2015-08-21 12:41:14 +00:00
Yaron Keren 2ecb118a1d Make test EOL tolerant by moving the symbol ot the first line
before any EOL changes the byte offset count and enable it on Windows.

llvm-svn: 245688
2015-08-21 10:46:46 +00:00
Yaron Keren 92660a2cdd Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.
llvm-svn: 245683
2015-08-21 09:27:24 +00:00
Aaron Ballman 7fc9feac3e Change the test to use the new python script instead of the more verbose RUN line.
llvm-svn: 245600
2015-08-20 19:21:07 +00:00
Alexander Kornienko 8e9110c160 [clang-tidy] Mention check_clang_tidy.py instead of check_clang_tidy.sh in the docs.
llvm-svn: 245587
2015-08-20 18:16:13 +00:00
Alexander Kornienko a7970eb424 [clang-tidy] Use check_clang_tidy.py instead of check_clang_tidy.sh by default.
llvm-svn: 245586
2015-08-20 18:11:13 +00:00
Alexander Kornienko 43556bb7f0 [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.
Summary:
Add check_clang_tidy.py script that is functionally identical to the
check_clang_tidy.py, but should also be functional on windows.

I've verified that the script works on linux. Would be nice if folks using
Windows could test the patch before I break windows bots ;)

Reviewers: chapuni, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 245583
2015-08-20 17:58:07 +00:00
Aaron Ballman 9392ced263 Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move constructor initializations that call copy constructors instead of move constructors.
llvm-svn: 245571
2015-08-20 15:52:52 +00:00
NAKAMURA Takumi ae6b329c8f Tweak clang-tidy-diff.py to pass JSON argument correctly to clang-tidy on win32 arg parser.
- Single quotation is not recognized.
  - Use """ to pass a double quotation.

It also reverts r211831.

llvm-svn: 245567
2015-08-20 15:04:46 +00:00
NAKAMURA Takumi 1544a819b7 Tweak clang-tools-extra/test/clang-tidy/file-filter.cpp to pass on win32.
FIXME: "-I %S/Inputs/file-filter/system/.." must be redundant.
On Win32, file-filter/system\system-header1.h precedes file-filter\header*.h due to code order between '/' and '\\'.

We should remove such a tweak to introduce the *right* path canonicalization.

Posix:
  file-filter/header*.h
  file-filter/system/system-header1.h

Win32:
  file-filter/system\system-header1.h
  file-filter\header*.h

Win32, tweaked:
  file-filter/system/..\header*.h
  file-filter/system\system-header1.h

It had been disabled since r220837.

llvm-svn: 245566
2015-08-20 15:04:39 +00:00
NAKAMURA Takumi ba598b5581 clang-tools-extra/test/lit.cfg: Prune an obsolete feature, python27. Now we requires python>=2.7.
clang-tools-extra/test/clang-tidy/clang-tidy-diff.cpp was the only user.

llvm-svn: 245565
2015-08-20 15:04:32 +00:00
Alexander Kornienko 74a44d9133 [clang-tidy] Fix bug in modernize-loop-convert check.
http://reviews.llvm.org/D12186

Patch by Angel Garcia!

llvm-svn: 245561
2015-08-20 13:18:23 +00:00
Benjamin Kramer e09303808a [clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous namespace.
While convenient, RecursiveASTVisitor generates a ridiculous amount of dead
template code. Making it not visible from the outside lets the compiler
eliminate some of it, shrinking clang-tidy by ~140k.

llvm-svn: 245548
2015-08-20 09:47:06 +00:00
Alexander Kornienko 20ce95f294 [clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.
llvm-svn: 245533
2015-08-20 01:44:14 +00:00
Alexander Kornienko 0777b3cffe [clang-tidy] Fix use-after-free in UseNullptrCheck.
llvm-svn: 245524
2015-08-19 23:57:34 +00:00
Alexander Kornienko 87d89d2be1 [clang-tidy] Work around failure in Darwin.
llvm-svn: 245517
2015-08-19 23:03:23 +00:00
Alexander Kornienko 1b7bf7a2a7 [clang-tidy] Add modernize-use-nullptr check, attempt 2.
This patch re-applies r245434 and r245471 reverted in r245493, and changes the
way custom null macros are configured. The test for custom null macros is
temporarily excluded and will be committed separately to reduce chances of
breakages.

Initial patches by Angel Garcia.

llvm-svn: 245511
2015-08-19 22:21:37 +00:00
Daniel Jasper 8d90e533ea Remove empty destructors added in r245500. I got confused by my
YouCompleteMe setup which apparently doesn't find the base classes and
thus doesn't understand that there is an implicit virtual destructor.

llvm-svn: 245510
2015-08-19 22:04:55 +00:00
Daniel Jasper d30dc3fc75 Fix IncludeInserter to allow for more than one added header per file.
Also adapt tests a bit to make it possible to test this. Removed
checking the number of errors reported per test. It was never actually
checked and doesn't seem particularly relevant to the test itself.

llvm-svn: 245500
2015-08-19 21:02:27 +00:00