Commit Graph

1108 Commits

Author SHA1 Message Date
Daniel Jasper f631191305 misc-unused-parameter: Ignore lambda static invokers.
llvm-svn: 248252
2015-09-22 09:20:20 +00:00
Angel Garcia Gomez 415af0184c Replace references to "transform" with references to "check" where neccessary in the documentation.
Summary: Replace references to "transform" with references to "check" where neccessary in the documentation.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

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

llvm-svn: 248153
2015-09-21 12:53:30 +00:00
Alexander Kornienko 3e748fbd17 [clang-tidy] Fixed formatting of headings in the docs.
llvm-svn: 248151
2015-09-21 12:13:27 +00:00
Angel Garcia Gomez f41a631b50 Refactor LoopConvertCheck.
Summary: Reorder the code in a more logical and understandable way.

Reviewers: klimek

Subscribers: cfe-commits, alexfh

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

llvm-svn: 248144
2015-09-21 09:32:59 +00:00
Craig Topper 18929c5069 Pass SourceLocation by value instead of by const reference since its just a 32-bit integer. NFC
llvm-svn: 248139
2015-09-21 01:33:03 +00:00
NAKAMURA Takumi e677e2f545 clang-tools-extra: Appease PR24881. [-Wdocumentation]
\returns doesn't accept \li, but \parblock \li.

llvm-svn: 248080
2015-09-19 02:21:28 +00:00
Angel Garcia Gomez b22084e113 Update clang-tidy documentation.
Summary: Update documentation of the modernize module with clang-modernize's documentation.

Subscribers: cfe-commits, klimek, alexfh

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

llvm-svn: 247987
2015-09-18 14:08:57 +00:00
Alexander Kornienko 8221ab3499 [clang-tidy] install helper scripts
Scripts are installed in same location as clang-fromat ones, so I think will be good idea to not create dedicated directory.

I checked this patch on my own build on RHEL 6.

Please check it in if it's OK, because I don't have SVN write access.

I think will be good idea to backport this patch to 3.7 release branch.

Probably same should be done for configure build.

Patch by Eugene Zelenko!

Differential revision: http://reviews.llvm.org/D12700

llvm-svn: 247890
2015-09-17 14:37:26 +00:00
Angel Garcia Gomez 387dc0b019 Add a test to modernize-loop-convert.
Summary: Add the test about replacements in several arguments of the same macro call, now that the problem has been fixed.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

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

llvm-svn: 247889
2015-09-17 14:25:39 +00:00
Aaron Ballman b9ea09c445 Refactors AST matching code to use the new AST matcher names. This patch correlates to r247885 which performs the AST matcher rename in Clang.
llvm-svn: 247886
2015-09-17 13:31:25 +00:00
Alexander Kornienko c7a6b40d10 [clang-tidy] Ignore spaces in -checks=
llvm-svn: 247812
2015-09-16 16:16:53 +00:00
Alexander Kornienko 4d48e1e85b [clang-tidy] google-runtime-int: made the matcher more restricting, added a test for a false positive
This should be NFC.

llvm-svn: 247806
2015-09-16 15:08:46 +00:00
Alexander Kornienko f63f9e3d6a [clang-tidy] Make google-runtime-int configurable.
llvm-svn: 247803
2015-09-16 14:36:22 +00:00
Alexander Kornienko 63b0573a2c [clang-tidy] Added a style guide link.
llvm-svn: 247798
2015-09-16 13:54:16 +00:00
Alexander Kornienko be50698bfc [clang-tidy] Improve the help text for -dump-config.
llvm-svn: 247792
2015-09-16 13:21:57 +00:00
NAKAMURA Takumi e74d042ca6 Remove garbage. The issue was fixed in r246856.
llvm-svn: 247689
2015-09-15 14:01:09 +00:00
Alexander Kornienko 1395253bf3 [clang-tidy] Update check name in the comment. NFC.
llvm-svn: 247682
2015-09-15 13:13:48 +00:00
Alexander Kornienko 64aa388efa [clang-tidy] updated misc-sizeof-container docs.
llvm-svn: 247580
2015-09-14 16:56:57 +00:00
Alexander Kornienko 6ae0a630b8 [clang-tidy] misc-sizeof-container: remove fix-it hints
This turned out to be a rather noisy check, so automated fixes will only do
harm. Remove them completely.

llvm-svn: 247578
2015-09-14 16:51:52 +00:00
Alexander Kornienko 4cd7ad9727 [clang-tidy] misc-sizeof-container: whitelist std::array
llvm-svn: 247559
2015-09-14 13:55:29 +00:00
NAKAMURA Takumi fdaefe533b Prune CRLF.
llvm-svn: 247541
2015-09-14 11:13:39 +00:00
Marek Kurdej 099227a270 Test commit.
llvm-svn: 247536
2015-09-14 08:05:12 +00:00
Alexander Kornienko 541de378ce [clang-tidy] misc-sizeof-container: whitelist std::bitset<>.
It's fine to use sizeof on std::bitset<>, since it doesn't have any external
storage, everything's inside.

llvm-svn: 247489
2015-09-11 22:54:44 +00:00
Alexander Kornienko 2681e7dcd0 [clang-tidy] Fix minor issues in the testing script.
llvm-svn: 247485
2015-09-11 22:38:26 +00:00
Angel Garcia Gomez bb9ca54bbe Another patch for modernize-loop-convert.
Summary:
1. Avoid converting loops that iterate over the size of a container and don't use its elements, as this would result in an unused-result warning.
2. Never capture the elements by value on lambdas, thus avoiding doing unnecessary copies and errors with non-copyable types.
3. The 'const auto &' instead of 'auto &' substitution on const containers now works on arrays and pseudoarrays as well.
4. The error about multiple replacements in the same macro call is now documented in the tests (not solved though).
5. Due to [1], I had to add a dummy usage of the range element (like "(void) *It;" or similars) on the tests that had empty loops.
6. I removed the braces from the CHECK comments. I think that there is no need for them, and they confuse vim.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 247399
2015-09-11 10:02:07 +00:00
NAKAMURA Takumi d7df405580 clang-tidy/misc-sizeof-container.cpp: Add explicit triple.
For targeting LLP64, like Windows x86, size_t is not unsigned long.

  tools/clang/tools/extra/test/clang-tidy/Output/misc-sizeof-container.cpp.tmp.cpp:33:12: error: target of using declaration conflicts with declaration already in scope [clang-diagnostic-error]
  using std::size_t;
             ^

llvm-svn: 247394
2015-09-11 08:16:30 +00:00
NAKAMURA Takumi c3115d1c28 clang-tidy/readability-inconsistent-declaration-parameter-name.cpp: Appease MS-incompatibility [-fno-delayed-template-parsing]
llvm-svn: 247393
2015-09-11 08:16:22 +00:00
Alexander Kornienko 7532d3e93d [clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
containers.

Summary:
sizeof(some_std_string) is likely to be an error. This check finds this
pattern and suggests using .size() instead.

Reviewers: djasper, klimek, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 247297
2015-09-10 16:37:46 +00:00
Alexander Kornienko 3285f1b850 [clang-tidy] add_new_check.py improvements: add doc file, refer it from .h
+ some console logging and minor cleanups.

llvm-svn: 247282
2015-09-10 13:56:39 +00:00
Alexander Kornienko a24501b2e1 [clang-tidy] Renamed tests files to be closer to the check names.
llvm-svn: 247266
2015-09-10 10:58:38 +00:00
Alexander Kornienko 11d4d6446e [clang-tidy] Add inconsistent declaration parameter name check
This is first of series of patches, porting code from my project colobot-lint,
as I mentioned recently in cfe-dev mailing list.

This patch adds a new check in readability module:
readability-inconsistent-declaration-parameter-name. I also added appropriate
testcases and documentation.

I chose readability module, as it seems it is the best place for it.

I think I followed the rules of LLVM coding guideline, but I may have missed
something, as I usually use other code formatting style.

http://reviews.llvm.org/D12462

Patch by Piotr Dziwinski!

llvm-svn: 247261
2015-09-10 10:07:11 +00:00
Alexander Kornienko f4e8b92ff5 Add a deprecation notice to the clang-modernize documentation.
Summary:
Add a deprecation notice to the clang-modernize documentation. Remove
the reference to the external JIRA tracker.

Reviewers: revane, klimek

Subscribers: cfe-commits

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

llvm-svn: 247258
2015-09-10 09:42:01 +00:00
Alexander Kornienko ffc277989b [clang-tidy] Fix PR22785.
Fix http://llvm.org/PR22785. Bug 22785 - readability-braces-around-statements
doesn't work well with macros.

http://reviews.llvm.org/D12729

Patch by Marek Kurdej!

llvm-svn: 247163
2015-09-09 17:06:09 +00:00
Alexander Kornienko d3e098140f [clang-tidy] Automatically redirect to the new page.
llvm-svn: 247153
2015-09-09 15:23:39 +00:00
Alexander Kornienko 16bb65431c Add a redirection page to unbreak external links.
Apparently, there are some links to http://clang.llvm.org/extra/clang-tidy.html
in the wild. It's better to keep them working.

llvm-svn: 247007
2015-09-08 12:26:32 +00:00
Alexander Kornienko 3f1153869f [clang-tidy] Fix run-clang-tidy.py.
Do not add "-*" to the list of checks. Make consistent the list of enabled
checks and the checks in use. Moreover, removing "-*" makes the behaviour
consistent with clang-tidy and allows user to use .clang-tidy configuration...

http://reviews.llvm.org/D12687

Patch by Marek Kurdej!

llvm-svn: 247002
2015-09-08 10:31:36 +00:00
Alexander Kornienko d96d89f6e5 [clang-tidy] Updated docs.
llvm-svn: 246996
2015-09-08 09:44:04 +00:00
Angel Garcia Gomez d930ef76ea 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

llvm-svn: 246989
2015-09-08 09:01:21 +00:00
Angel Garcia Gomez bd0ec69e0a 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

llvm-svn: 246879
2015-09-04 21:37:05 +00:00
Alexander Kornienko 13f0bb8b3a [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!

llvm-svn: 246856
2015-09-04 15:46:51 +00:00
Alexander Kornienko c0ebfbe5e1 [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!

llvm-svn: 246854
2015-09-04 14:56:57 +00:00
Angel Garcia Gomez 8d01772dae 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

llvm-svn: 246762
2015-09-03 12:28:11 +00:00
Aaron Ballman d428e203a0 Updating the code owners list.
llvm-svn: 246698
2015-09-02 20:00:41 +00:00
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