Граф коммитов

1178 Коммитов

Автор SHA1 Сообщение Дата
Angel Garcia Gomez 915a754db5 Avoid using rvalue references with trivially copyable types.
Summary:
When the dereference operator returns a value that is trivially
copyable (like a pointer), copy it. After this change, modernize-loop-convert
check can be applied to the whole llvm source code without breaking any build
or test.

Reviewers: alexfh, klimek

Subscribers: alexfh, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 09:01:21 +00:00
Angel Garcia Gomez 77ada21fd5 Avoid repeated replacements on loop-convert check.
Summary: The InitListExpr subtree is visited twice, this caused the check to do multiple replacements. Added a set to avoid it.

Reviewers: klimek, alexfh

Subscribers: cfe-commits, alexfh

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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246879 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-04 21:37:05 +00:00
Alexander Kornienko 344639aa33 [clang-tidy] Fix llvm-include-order check on Windows.
IncludeDirectives struct used a StringRef that pointed to a stack variable
(SmallString<128> FilenameBuffer from PPDirectives.cpp:1513).

http://reviews.llvm.org/D12632

Patch by Marek Kurdej!


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-04 15:46:51 +00:00
Alexander Kornienko ed37914591 [clang-tidy] Fix add_new_check.py.
This fixes the case where the check should be added at the end of
the list of checks in CMakeLists.txt of the corresponding module.
Before it was added after LINK_LIBS line.

http://reviews.llvm.org/D12629

Patch by Marek Kurdej!


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246854 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-04 14:56:57 +00:00
Angel Garcia Gomez f791a2b443 Two more fixes to loop convert.
Summary: Ensure that the alias has the same type than the loop variable. Now it works with lambda captures.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 12:28:11 +00:00
Aaron Ballman d8afa7237b Updating the code owners list.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 20:00:41 +00:00
Aaron Ballman 1ebb84a48b 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246663 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:20:42 +00:00
Aaron Ballman 3ce14e6a70 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246661 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:05:21 +00:00
Aaron Ballman a21340ecea 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246660 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:04:15 +00:00
Angel Garcia Gomez 4497fda2f3 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 14:25:08 +00:00
Alexander Kornienko 1604b41ad6 [clang-tidy] Updated the check name in the doc.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246643 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 12:01:51 +00:00
Angel Garcia Gomez 473ac6e964 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246638 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 10:20:00 +00:00
Yaron Keren 96dd782851 Add \n to the regex in clang-tidy-diff.py in order to fix http://llvm.org/PR24637,
git usecase for multiple files diff.



git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 19:08:17 +00:00
Angel Garcia Gomez 8a16759017 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 15:05:15 +00:00
Aaron Ballman e401b5a840 Allow the static assert clang-tidy checker to run over C code.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246495 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 21:54:42 +00:00
Aaron Ballman 3711dea499 Help the clang-tidy helper script to understand C files better.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246494 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 21:53:55 +00:00
Aaron Ballman be5160d5f2 Using an early return as it is more clear; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 15:28:57 +00:00
Alexander Kornienko a430467d0e [clang-tidy] misc-assert-side-effect: support assert macros defined through other macros
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 14:47:14 +00:00
Aaron Ballman 2c5d53649a Using an early return as it is more clear; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 14:23:21 +00:00
Alexander Kornienko d356642296 [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.


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246437 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 13:17:43 +00:00
Aaron Ballman dbe52d1396 Updated to make use of the AST matcher instead of a custom matcher; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 19:40:30 +00:00
Aaron Ballman fbf0ffc607 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 19:27:19 +00:00
Aaron Ballman c9bb1cff21 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246310 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 17:58:10 +00:00
Aaron Ballman 56c3af312b 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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 13:20:46 +00:00
Alexander Kornienko 8e50bd634a [clang-tidy] Documented the reason to run the test in C++98 mode.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246238 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 23:43:39 +00:00
Aaron Ballman 38d515203f Reverting r246209 while I investigate a build bot failure: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246224 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 22:19:50 +00:00
Aaron Ballman c95659f8a2 Expose language options to the checkers; disable UseNullptrCheck when not compiling in C++11 mode.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 21:17:47 +00:00
Alexander Kornienko 772268716e [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.


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 18:10:07 +00:00
Alexander Kornienko 21940bf5bc [clang-tidy] Renamed a test file to <check-name>.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 18:03:37 +00:00
Alexander Kornienko 725e03325e [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.


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246169 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 18:01:58 +00:00
Angel Garcia Gomez 1789309d16 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246039 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 17:08:24 +00:00
Angel Garcia Gomez c186910441 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@246034 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 14:51:11 +00:00
Angel Garcia Gomez 3035fc1706 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245942 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 15:44:00 +00:00
Angel Garcia Gomez 43cfbf1a98 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245933 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 13:03:43 +00:00
Angel Garcia Gomez 9bf3f1ff62 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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 08:39:34 +00:00
Angel Garcia Gomez 4ec41cc403 [clang-tidy] Migrate UseAuto from clang-modernize to clang-tidy.
http://reviews.llvm.org/D12231


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 15:08:51 +00:00
Angel Garcia Gomez d9216bc189 Test commit!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 13:55:16 +00:00
Alexander Kornienko 46bb912039 [clang-tidy] Remove check_clang_tidy.sh that has been replaced with check_clang_tidy.py.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 12:41:14 +00:00
Yaron Keren ddcf421d05 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.



git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245688 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 10:46:46 +00:00
Yaron Keren 0ca9a2b8ca Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245683 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 09:27:24 +00:00
Aaron Ballman a696c7fa1e Change the test to use the new python script instead of the more verbose RUN line.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245600 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 19:21:07 +00:00
Alexander Kornienko 97a0f2106a [clang-tidy] Mention check_clang_tidy.py instead of check_clang_tidy.sh in the docs.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 18:16:13 +00:00
Alexander Kornienko abd5f474fe [clang-tidy] Use check_clang_tidy.py instead of check_clang_tidy.sh by default.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 18:11:13 +00:00
Alexander Kornienko 5fd9bc99b2 [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

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 17:58:07 +00:00
Aaron Ballman 9116e194f2 Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move constructor initializations that call copy constructors instead of move constructors.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245571 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 15:52:52 +00:00
NAKAMURA Takumi a729532225 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.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245567 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 15:04:46 +00:00
NAKAMURA Takumi e63c1357d5 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.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 15:04:39 +00:00
NAKAMURA Takumi 53a6d908da 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.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245565 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 15:04:32 +00:00
Alexander Kornienko 0411b8b91e [clang-tidy] Fix bug in modernize-loop-convert check.
http://reviews.llvm.org/D12186

Patch by Angel Garcia!


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 13:18:23 +00:00
Benjamin Kramer 4066c60c2d [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.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245548 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 09:47:06 +00:00