Commit Graph

1259 Commits

Author SHA1 Message Date
Manuel Klimek 143b644238 Fix loop-convert for const references to containers.
Previously we would use a non-const loop variable in the range-based
loop for:
void f(const std::vector<int> &v) {
  for (size_t i = 0; i < v.size(); ++i) {
Now we use const auto&.

Note that we'll also want to use a copy at least for simple types.

llvm-svn: 248418
2015-09-23 18:40:47 +00:00
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
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
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
Daniel Jasper 4d871f99c7 Lazily initialize HeaderFilter in ClangTidyDiagnosticConsumer. This
removes a corner case in tests that don't set the diagnostic consumer.
In tests, it is good, not to set the diagnostic consumer so that Clang's
parsing diagnostics are still displayed in the test output and only
ClangTidy's output is analyzed differently.

llvm-svn: 244745
2015-08-12 13:16:41 +00:00
Manuel Klimek 9b2c45398f Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.
llvm-svn: 244722
2015-08-12 07:57:16 +00:00
David Blaikie 2f1d01954c Revert the diagnostic improvements in r244602 as they introduced a problematic dependency
Seems we had some internal uses that include ClangTidyTest.h and weren't
ready for a gtest dependency. Reverting to give Manuel some time to look
into it.

llvm-svn: 244658
2015-08-11 20:21:45 +00:00
Manuel Klimek e8c8d887be 1. Disable tests that currently cannot work on windows due to missing path canonicalization in the file manager.
2. Add better output when a clang-tidy unit test fails so it's clear what the error is.

llvm-svn: 244602
2015-08-11 14:21:26 +00:00
NAKAMURA Takumi 81f1ffdbbb Also ClangTidyTests requires clangLex.
llvm-svn: 244599
2015-08-11 13:16:51 +00:00
Manuel Klimek 3d67c88506 Fix strict dependency uncovered by windows bot.
llvm-svn: 244598
2015-08-11 13:11:29 +00:00
Manuel Klimek 46e82c3dcd Do not use inheriting constructors.
llvm-svn: 244597
2015-08-11 12:59:22 +00:00
Manuel Klimek f60364326c Default initialize from explicitly constructed object.
llvm-svn: 244596
2015-08-11 12:13:15 +00:00
Manuel Klimek 795daa2e8f Fix shadowing of type with variable.
llvm-svn: 244587
2015-08-11 12:02:28 +00:00
Manuel Klimek d00d6f1d43 Add an IncludeInserter to clang-tidy.
Will be used to allow checks to insert includes at the right position.

llvm-svn: 244586
2015-08-11 11:37:48 +00:00
Daniel Jasper b3a74c659b misc-unused-parameters: Don't touch K&R style functions.
We couldn't calculate the removal ranges properly at this point.

llvm-svn: 244454
2015-08-10 15:45:46 +00:00
Yaron Keren 43b7ca7b43 Silence gcc 5.1 unused variable warnings using LLVM_ATTRIBUTE_UNUSED.
llvm-svn: 244329
2015-08-07 16:37:34 +00:00
Aaron Ballman 3abb97e4c6 Correcting and adding tests for r244206.
llvm-svn: 244208
2015-08-06 12:15:47 +00:00
Aaron Ballman 5890717e70 Add the "quit" command as a way to terminate clang-query interactive sessions.
llvm-svn: 244206
2015-08-06 11:56:57 +00:00
Tanya Lattner 9aad4380ea Update references to new lists.llvm.org mailing lists.
llvm-svn: 244001
2015-08-05 03:56:44 +00:00
Alexander Kornienko 2644cae3d5 [clang-tidy] Improve the misc-unused-alias-decl message
"this namespace alias decl is unused" -> "namespace alias decl '...' is unused"

llvm-svn: 243906
2015-08-03 22:02:08 +00:00
Daniel Jasper cf452e5501 Replace callback-if with isExpansionInMainFile as suggested in post
commit review.

llvm-svn: 243871
2015-08-03 10:52:27 +00:00
Daniel Jasper 0aeed7c0b8 Add missing 'override'.
llvm-svn: 243773
2015-07-31 18:32:38 +00:00
Daniel Jasper bb42b03021 Add misc-unused-alias-decls check that currently finds unused namespace
alias declarations. In the future, we might want to reuse it to also
fine unsed using declarations and such.

llvm-svn: 243754
2015-07-31 16:08:10 +00:00
Alexander Kornienko b4fbb173f0 [clang-tidy] Support replacements in macro arguments in misc-inefficient-algorithm
Summary:
Support replacements in macro arguments in the
misc-inefficient-algorithm check.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 243747
2015-07-31 13:34:58 +00:00
NAKAMURA Takumi 0dae64a554 Move an extra switch to clang-tools-extra/test/clang-tidy/misc-unused-parameters.cpp from check_clang_tidy.sh.
It also rolls back r242984 and r242985.

llvm-svn: 243491
2015-07-28 22:41:04 +00:00
Daniel Jasper 542482e63d misc-unused-parameters: Only remove parameters in the main source file.
In headers, they might always be pulled in to different TUs, even if
they are declared static or nested in an unnamed namespace.

llvm-svn: 243414
2015-07-28 13:19:12 +00:00
Daniel Jasper 718029ba6b misc-unused-parameters: Properly handle static class members.
Not sure why I wrote what I wrote before.

llvm-svn: 243403
2015-07-28 10:39:25 +00:00
Alexander Kornienko 102d2c252a [clang-tidy] Set current main file name in tests.
llvm-svn: 243272
2015-07-27 14:54:31 +00:00
Aaron Ballman 6db02dd8f0 Trying again to a failing test the bots found with r243266.
llvm-svn: 243269
2015-07-27 13:59:24 +00:00
Aaron Ballman 84b1b00926 Fixing a failing test the bots found with r243266.
llvm-svn: 243268
2015-07-27 13:47:35 +00:00
Daniel Jasper 9fe55a32b7 misc-unused-parameters: Don't warn on ParmVarDecls in the return type.
As there don't seem to be a good way of formulating a matcher that
finds all pairs of functions and their ParmVarDecls, just match on
functionDecls and iterate over their parameters. This should also be
more efficient as some checks are only performed once per function.

llvm-svn: 243267
2015-07-27 13:46:37 +00:00
Aaron Ballman 5a4892b4fa Updating the documentation for clang-tidy. Removes some non-ASCII characters from the documentation, and removes shell-specific single quote characters as they cause issues for some shells (such as on Windows).
llvm-svn: 243266
2015-07-27 13:41:30 +00:00
Alexander Kornienko ae8f23efa8 [clang-tidy] Don't duplicate the leading slash.
llvm-svn: 243265
2015-07-27 13:07:50 +00:00
Daniel Jasper 1c6fc3b8f0 misc-unused-parameters: Fix bug where the check was looking at
ParmVarDecls of function types.

llvm-svn: 243026
2015-07-23 17:26:36 +00:00
NAKAMURA Takumi 4c8342b73e Fix the shell script check_clang_tidy.sh in r242984.
llvm-svn: 242985
2015-07-23 06:03:40 +00:00
NAKAMURA Takumi d4ed83aae7 Appease test/clang-tidy/misc-unused-parameters.cpp for targeting *-win32, to add -fno-delayed-template-parsing.
Note, clang-tidy tests wouldn't run on Windows hosts since they are disabled with REQUIRES:shell.
The failure would be raised with cross building.

llvm-svn: 242984
2015-07-23 05:52:02 +00:00
Daniel Jasper 9b46e9c5de misc-unused-parameters: Fix handling of parameters in template functions.
The parameters of the function templates were being marked as
incorrectly be marked as unused. Added a test for this and changed the
check to use the same

  isReferenced() || !getDeclName()

logic as Sema::DiagnoseUnusedParameters.
Patch Scott Wallace, thank you!

llvm-svn: 242912
2015-07-22 17:30:35 +00:00
Daniel Jasper 82efabbb27 Extend misc-unused-parameters to delete parameters of local functions.
Also see: llvm.org/PR24180.

llvm-svn: 242659
2015-07-20 03:42:38 +00:00
Daniel Jasper 9c6df889c4 Initial version of clang-tidy check to find and fix unused parameters.
Also see: llvm.org/PR24180.

llvm-svn: 242654
2015-07-20 01:06:44 +00:00
Benjamin Kramer 3204a105e3 [clang-modernize] Don't rely on iterator auto-dereferencing.
llvm-svn: 242607
2015-07-18 14:35:41 +00:00
Hans Wennborg 0b1f36e2c8 docs/conf.py: bump version to 3.8
llvm-svn: 242247
2015-07-14 23:37:08 +00:00
John Thompson 4018c62428 Added mechanism to modularize for doing a compilation precheck
to determine files that have comnpilation or dependency problems.
A new -display-file-lists option use this to display lists of good files
(no compile errors), problem files, and a combined list with
problem files preceded by a '#'.  The problem files list can be
used in the module map generation assistant mode to exclude
problem files.  The combined files list can be used during module
map development.  See added docs.

llvm-svn: 241880
2015-07-10 00:37:25 +00:00
John Thompson 8b629f585d Fixed line-endings.
llvm-svn: 241744
2015-07-08 22:00:56 +00:00
John Thompson 91656d2db6 Fixed erroneous comments.
llvm-svn: 241726
2015-07-08 21:05:57 +00:00
John Thompson ddd7dea4b1 Fixed erroneous comment.
llvm-svn: 241724
2015-07-08 20:57:32 +00:00
Yaron Keren 40178c352e Revert r241330. It compiled with Visual C++ 2013 and gcc 4.9.1 (mingw) but now fails the bots.
llvm-svn: 241335
2015-07-03 09:30:33 +00:00
Yaron Keren 452670165c Replace some const std::string & with llvm::StringRef or std::string
and std::move to avoid implicit std::string construction.

Patch by Eugene Kosov.

llvm-svn: 241330
2015-07-03 09:16:20 +00:00
Daniel Marjamaki e0384e51b0 [clang-tidy] Enhance clang-tidy misc-macro-repeated-side-effects...
Enhance clang-tidy misc-macro-repeated-side-effects to handle ? and : better.

When ? is used in a macro, there are 2 possible control flow paths through the macro.
These paths are tracked separately so problems can be detected properly.

http://reviews.llvm.org/D10653

llvm-svn: 241245
2015-07-02 07:49:55 +00:00
Daniel Marjamaki bf5e59c78b [clang-tidy] minor coding style tweak. make functions static.
llvm-svn: 241160
2015-07-01 13:29:27 +00:00
Alexander Kornienko 6ae400d122 [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...
Enhance clang-tidy readability-simplify-boolean-expr to handle 'if (e) return
true; return false;' and improve replacement expressions.

This changeset extends the simplify boolean expression check in clang-tidy to
simplify if (e) return true; return false; to return e; (note the lack of an
else clause on the if statement.) By default, chained conditional assignment is
left unchanged, unless a configuration parameter is set to non-zero to override
this behavior.

It also improves the handling of replacement expressions to apply
static_cast<bool>(expr) when expr is not of type bool.

http://reviews.llvm.org/D9810

Patch by Richard Thomson!

llvm-svn: 241155
2015-07-01 12:39:40 +00:00
Daniel Marjamaki 4a38b0b493 [clang-tidy] Fix false positives in the macro parentheses checker
Summary:
There were false positives in C++ code where macro argument was a type.

Reviewers: alexfh

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

llvm-svn: 240938
2015-06-29 12:18:11 +00:00
Daniel Marjamaki 91d35a5e22 [clang-tidy] Fix false positives in misc-macro-parentheses checker
llvm-svn: 240399
2015-06-23 12:45:14 +00:00
David Blaikie 1f02f962f5 Update for LLVM API change to return by InputArgList directly (rather than by pointer) from ParseArgs
llvm-svn: 240348
2015-06-22 22:06:58 +00:00
David Blaikie faa9280bdc Update for ParseARgs ArrayRef-ification
llvm-svn: 240239
2015-06-21 06:58:19 +00:00
Adrian Prantl db8ef097be Add missing dependency clangFrontend to clangQuery.
llvm-svn: 240227
2015-06-20 19:28:07 +00:00
Adrian Prantl 51540daec6 Add missing dependency clangFrontend to unit test.
llvm-svn: 240226
2015-06-20 19:21:04 +00:00
Justin Bogner 7b92cac037 clang-tidy: Remove an unused private field. NFC
Clang was warning on this.

llvm-svn: 239988
2015-06-18 04:15:04 +00:00
Daniel Marjamaki 71c9257f07 clang-tidy: Add checker that warn when macro argument with side effects is repeated in the macro
llvm-svn: 239909
2015-06-17 14:19:35 +00:00
Alexander Kornienko 50d7f4617f [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations.
llvm-svn: 239904
2015-06-17 13:11:37 +00:00
Daniel Marjamaki 302275a938 clang-tidy: Add checker that warns about missing parentheses in macros
* calculations in the replacement list should be inside parentheses
* macro arguments should be inside parentheses

llvm-svn: 239820
2015-06-16 14:27:31 +00:00
John Thompson 96f5551b03 Fixed modularize to warn about missing headers referenced in a module map.
llvm-svn: 239122
2015-06-04 23:35:19 +00:00
Samuel Benzaquen cfacf8ae9e [clang-tidy] Force braces around leaf 'else if' for consistency.
Summary:
Force braces around leaf 'else if' for consistency.
This complements r233697.

Reviewers: alexfh

Subscribers: curdeius, cfe-commits

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

llvm-svn: 239054
2015-06-04 16:36:58 +00:00
John Thompson 81cf1e8931 Fixed option description. '=' is required.
llvm-svn: 238998
2015-06-04 01:12:56 +00:00
John Thompson cf777e9f05 Fixed option comment. '=' is required.
llvm-svn: 238997
2015-06-04 01:10:19 +00:00
Rafael Espindola d218565c04 Update for clang API change.
Patch by Косов Евгений.

llvm-svn: 238775
2015-06-01 20:00:20 +00:00
Szabolcs Sipos 43a298cb36 [clang-tidy] Fix for llvm.org/PR23355
misc-static-assert and misc-assert-side-effect will handle __builtin_expect based asserts correctly.

llvm-svn: 238548
2015-05-29 09:49:59 +00:00
Alexander Kornienko 7ed89bcd3b [clang-tidy] Renamed misc-noexcept-move-ctors to misc-noexcept-move-constructor
llvm-svn: 238326
2015-05-27 14:24:11 +00:00
Alexander Kornienko bf5bd94142 [clang-tidy] misc-noexcept-move-ctors should ignore implicit constructors and assignments.
llvm-svn: 238202
2015-05-26 14:35:09 +00:00
Alexander Kornienko 2b56649cd2 [clang-tidy] Don't issue most google-readability-casting warnings on .c files included in other files.
This is done sometimes for testing purposes, and the check needs to handle this
consistently.

llvm-svn: 238193
2015-05-26 10:47:48 +00:00
Szabolcs Sipos 0acf19ed53 [clang-tidy] Fix for llvm.org/PR23572
misc-static-assert won't report asserts whose conditions contain calls to non constexpr functions.

llvm-svn: 238098
2015-05-23 14:21:01 +00:00
Alexander Kornienko 3396a8b8e6 Add a clang-tidy check for move constructors/assignment ops without noexcept.
Summary:
Add a clang-tidy check (misc-noexcept-move-ctors) for move constructors
and assignment operators not using noexcept.

http://llvm.org/PR23519

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 238013
2015-05-22 10:31:17 +00:00
Alexander Kornienko 19bbeaf410 [clang-tidy] Disable google-readability-casting for .c files and their headers.
Some people have reasons to compile their .c files as C++ in some configurations
(e.g. for testing purposes), so just looking at LangOptions is not enough. This
patch disables the check on all .c files (and also for the headers included from
.c files).

llvm-svn: 237905
2015-05-21 14:08:56 +00:00
Reid Kleckner 558850ac59 Copy lit shell changes from clang to clang-tools-extra, excluding some failing tests
llvm-svn: 237832
2015-05-20 20:33:18 +00:00
Justin Bogner e3acc8bc56 docs: Spell a couple of cmake options with =ON in the docs
Patch by Albert Astals Cid. Thanks!

llvm-svn: 237554
2015-05-18 05:05:49 +00:00
Alexander Kornienko fb3e2cd8cc [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr check...
Enhance clang-tidy readability-simplify-boolean-expr check to handle chained
conditional assignment and chained conditional return.

Based on feedback from applying this tool to the clang/LLVM codebase, this
changeset improves the readability-simplify-boolean-expr check so that
conditional assignment or return statements at the end of a chain of if/else if
statements are left unchanged unless a configuration option is supplied.

http://reviews.llvm.org/D8996

Patch by Richard Thomson!

llvm-svn: 237541
2015-05-17 12:31:12 +00:00
Richard Smith 9d5ae2174b Update to match clang r237508.
llvm-svn: 237509
2015-05-16 03:10:31 +00:00
Alexander Kornienko bdaa681fc6 [clang-tidy] Treat all types with non-trivial destructors as RAII.
This solves some false negatives at a cost of adding some false positives that
can be fixed easily and (almost) automatically.

llvm-svn: 237120
2015-05-12 12:17:20 +00:00
Nikola Smiljanic 90476a5d90 Fix misleading parameter name for PPCallbacks::FileSkipped.
Patch thanks to Vladimir Voskresensky.

llvm-svn: 237116
2015-05-12 11:48:21 +00:00
Daniel Marjamaki 89ec723468 Refactor MacroInfo so range for loops can be used to iterate its tokens.
Differential Revision: http://reviews.llvm.org/D9079

llvm-svn: 236976
2015-05-11 08:26:25 +00:00
Szabolcs Sipos 60ce8bb0be [clang-tidy] Fix for llvm.org/PR23161
The misc-static-assert check will not warn on the followings:
    assert(NULL == "shouldn't warn");
    assert(__null == "shouldn't warn");

Where NULL is a macro defined as __null.

llvm-svn: 236812
2015-05-08 07:56:24 +00:00
John Thompson f9f62b116f Changed option processing to implicitly use -x c++ if no other -x option specified. Added implicit -w option to disable compilation warnings, in particular to avoid warning on pragma once.
llvm-svn: 236625
2015-05-06 18:43:01 +00:00
John Thompson fcf3f47d7a Fixed infinite recursion bug.
llvm-svn: 236624
2015-05-06 18:39:15 +00:00
Richard Smith 33de8566f0 Update to match clang r236404.
llvm-svn: 236405
2015-05-04 03:15:55 +00:00
NAKAMURA Takumi 22d8830813 Revert r236001, "Disable clang-tools-extra/test/pp-trace/pp-trace-modules.cpp on win32 for now. Investigating."
It has been resolved.

llvm-svn: 236309
2015-05-01 08:38:22 +00:00
NAKAMURA Takumi 6eb00faf9d Disable clang-tools-extra/test/pp-trace/pp-trace-modules.cpp on win32 for now. Investigating.
llvm-svn: 236001
2015-04-28 17:31:36 +00:00
Daniel Jasper a73aed0c9b clang-tidy: [readability-else-after-return] Fix false positive. This
might be a little too strict now, but better be too strict than do the
wrong thing.

llvm-svn: 235932
2015-04-27 22:42:20 +00:00