Commit Graph

1041 Commits

Author SHA1 Message Date
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
Justin Bogner 71e1a579b2 Revert "[clang-tidy] Add use-nullptr check to clang-tidy."
The new test is failing on darwin:

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10339/

This reverts r245434 and its follow up r245471.

llvm-svn: 245493
2015-08-19 20:30:07 +00:00
Aaron Ballman f7c25368b7 Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
llvm-svn: 245492
2015-08-19 20:26:22 +00:00
Aaron Ballman 5cedc8fbfa Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
llvm-svn: 245484
2015-08-19 19:29:23 +00:00
Alexander Kornienko be6e053938 [clang-tidy] Fix a bug in UseNullptrCheck.
http://reviews.llvm.org/D12162

Patch by Angel Garcia!

llvm-svn: 245471
2015-08-19 17:50:22 +00:00
Alexander Kornienko e1292f8e4e [clang-tidy] Fix LoopConvertCheck bug.
Fix LoopConvertCheck bug: StringRef to temporaries.

Also add LLVM_ATTRIBUTE_UNUSED to ModernizeModuleAnchorDestination.

http://reviews.llvm.org/D12157

Patch by Angel Garcia!

llvm-svn: 245458
2015-08-19 16:54:51 +00:00
NAKAMURA Takumi bc224b8049 clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease targeting msvc.
llvm-svn: 245435
2015-08-19 13:22:58 +00:00
Alexander Kornienko bd725b4537 [clang-tidy] Add use-nullptr check to clang-tidy.
Move UseNullptr from clang-modernize to modernize module in clang-tidy.

http://reviews.llvm.org/D12081

Patch by Angel Garcia!

llvm-svn: 245434
2015-08-19 13:13:12 +00:00
Alexander Kornienko 76c288062a [clang-tidy] Add new IdentifierNaming check
This check will try to enforce coding guidelines on the identifiers naming.
It supports lower_case, UPPER_CASE, camelBack and CamelCase casing and
tries to convert from one to another if a mismatch is detected.

It also supports a fixed prefix and suffix that will be prepended or appended
to the identifiers, regardless of the casing.

Many configuration options are available, in order to be able to create
different rules for different kind of identifier. In general, the
rules are falling back to a more generic rule if the specific case is not
configured.

http://reviews.llvm.org/D10933

Patch by Beren Minor!

llvm-svn: 245429
2015-08-19 11:15:36 +00:00
Alexander Kornienko 0497084b69 [clang-tidy] Add loop-convert check to clang-tidy.
Move LoopConvert from clang-modernize to modernize module in clang-tidy.

http://reviews.llvm.org/D12076

Patch by Angel Garcia!

llvm-svn: 245427
2015-08-19 09:11:46 +00:00
Ehsan Akhgari c62c639610 Insert override at the same line as the end of the function declaration
Summary:
The existing check converts the code pattern below:

  void f()
  {
  }

to:

  void f()
  override {
  }

which is fairly sub-optimal.  This patch fixes this by inserting the
override keyword on the same line as the function declaration if
possible, so that we instead get:

  void f() override
  {
  }

We do this by looking for the last token before the start of the body
and inserting the override keyword at the end of its location.  Note
that we handle const, volatile and ref-qualifiers correctly.

Test Plan: Includes an automated test.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 245401
2015-08-19 02:05:37 +00:00
Aaron Ballman 73a8f05e5d We no longer need a custom matcher for this; use the builtin AST matcher instead. NFC, and existing tests should cover this change.
llvm-svn: 245340
2015-08-18 20:27:44 +00:00
Alexander Kornienko fc8cd685e1 [clang-tidy] Fixed typos and formatting in a comment. NFC
llvm-svn: 245310
2015-08-18 16:43:07 +00:00
Alexander Kornienko e0c900ed05 [clang-tidy] Fix a use-after-free.
llvm-svn: 245215
2015-08-17 11:27:11 +00:00
Alexander Kornienko 65eccb463d [clang-tidy] Allow use of -list-checks option without need to pass source files.
Initialize CommonOptionsParser with ZeroOrOne NumOccurrenceFlag so callers can
pass -list-checks without the need to pass additional positional parameters,
then add dummy file if none were supplied.

http://reviews.llvm.org/D12070

Patch by Don Hinton!

llvm-svn: 245205
2015-08-17 10:03:27 +00:00
NAKAMURA Takumi caad877d3e clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Tweak not to override -std=c++11.
llvm-svn: 245147
2015-08-15 02:27:22 +00:00
NAKAMURA Takumi 654c2bbaf5 clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Appease targeting MS to give -fno-delayed-template-parsing.
llvm-svn: 245146
2015-08-15 02:05:49 +00:00
NAKAMURA Takumi fe745cad47 clangTidyModernizeModule: Update libdeps.
llvm-svn: 245144
2015-08-15 01:32:15 +00:00
Alexander Kornienko 5f252cac51 [clang-tidy] Move IncludeSorter.* and IncludeInserter.* to clang-tidy/utils/
This is better structurally and it also fixes a linker error in the configure
build.

llvm-svn: 245052
2015-08-14 14:31:31 +00:00
Daniel Jasper ea223a7a6a misc-unused-parameters: Fix crasher with C forward declarations that
can leave out the parameter list.

llvm-svn: 245048
2015-08-14 13:39:57 +00:00
Alexander Kornienko 078ab134ea [clang-tidy] Don't use delegating constructors.
llvm-svn: 245046
2015-08-14 13:23:55 +00:00
Alexander Kornienko fc650864ef [clang-tidy] Create clang-tidy module modernize. Add pass-by-value check.
This is the first step for migrating cppmodernize to clang-tidy.

http://reviews.llvm.org/D11946

Patch by Angel Garcia!

llvm-svn: 245045
2015-08-14 13:17:11 +00:00
Alexander Kornienko 8cc024ee37 [clang-tidy] Fix IncludeInserter/IncludeSorter bug.
If there weren't any includes in the file, or all of them had 'IncludeKind'
greater than the desired one, then 'CreateIncludeInsertion' didn't work.

http://reviews.llvm.org/D12017

Patch by Angel Garcia!

llvm-svn: 245042
2015-08-14 12:33:25 +00:00
Manuel Klimek 0a19e90b49 Fix formatting.
llvm-svn: 244876
2015-08-13 09:09:28 +00:00
Alexander Kornienko b7029d05a1 [clang-tidy] Make FileOptionsProvider fields protected to make extending it easier
llvm-svn: 244793
2015-08-12 19:29:57 +00:00