Commit Graph

2597 Commits

Author SHA1 Message Date
Jonas Toth a88abd58b4 [clang-tidy] test commit for granted access
llvm-svn: 312102
2017-08-30 07:50:28 +00:00
Daniel Marjamaki cad8443724 [clang-tidy] Fix 'misc-misplaced-widening-cast' assertion error.
Reviewers: alexfh, xazax.hun, danielmarjamaki

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

llvm-svn: 311984
2017-08-29 06:25:24 +00:00
Michal Gorny a81de445c1 [cmake] Support running extra clang tool tests without static analyzer
Support running the extra clang tool tests when the static analyzer
is disabled. Disable the relevant clang-tidy tests and one include-fixer
test that require it to work.

Previously, the tests were disabled entirely with
CLANG_ENABLE_STATIC_ANALYZER being false. Now, the tests are being
enabled and the relevant tests are excluded and marked unsupported
appropriately.

In order to disable clang-tidy tests, the whole test directory is added
to the exclude lists, to avoid having to explicitly add 'REQUIRES' line
to every single test. If the other solution is preferable, I can update
the patch.

The yamldb_plugin include-fixer test is also updated to be disabled
without static analyzer. It fails in that case because clang is not
outputting a replacement suggestion -- but I don't know the exact
reason why it does not do that.

Differential Revision: https://reviews.llvm.org/D37188

llvm-svn: 311983
2017-08-29 05:58:08 +00:00
Haojian Wu e928c2b67e [clang-tidy] Add missing IgnoreMacros doc for modernize-use-equals-default.
A followup of rL311136.

llvm-svn: 311654
2017-08-24 13:45:18 +00:00
Haojian Wu 3f495944de [clang-tidy] A follow-up fix of braced-init-list constructors in make-unique check.
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D37066

llvm-svn: 311652
2017-08-24 13:35:55 +00:00
Alexander Kornienko 15ea4ebbb2 [clang-tidy] bugprone-undefined-memory-manipulation: include type into the message
Having the actual type in the message helps a lot understanding warnings in templates ;)

+ fix a false negative for type aliases.

llvm-svn: 311651
2017-08-24 12:11:05 +00:00
Ilya Biryukov 75337e8d66 [clangd] Updated ClangdServer comments. NFC.
llvm-svn: 311436
2017-08-22 09:16:46 +00:00
Alexander Kornienko dea43983ae [clang-tidy] Add modernize-use-equals-default.IgnoreMacros option
llvm-svn: 311136
2017-08-17 23:07:59 +00:00
Haojian Wu 80330ffc6b [clang-tidy] Ignore statements inside a template instantiation.
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36822

llvm-svn: 311086
2017-08-17 14:12:38 +00:00
Haojian Wu 4b956cb70d [clang-tidy] Don't generate fixes for initializer_list constructor in make_unique check.
Summary:
The current fix will break the compilation -- because braced list is not
deducible in std::make_unique (with the use of forwarding) without
specifying the type explicitly.

We could support it in the future.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36786

llvm-svn: 311078
2017-08-17 10:14:52 +00:00
Chih-Hung Hsieh 2414429962 [clang-tidy] Remove unused static variable.
Differential Revision: https://reviews.llvm.org/D36761

llvm-svn: 311040
2017-08-16 21:00:06 +00:00
Chih-Hung Hsieh a54d379812 [clang-tidy] Use const char* to compile with VC cl.exe.
Summary:
cl.exe does not accept constexpr char FuncBindingStr[] = ...

Differential Revision: https://reviews.llvm.org/D36761

llvm-svn: 311035
2017-08-16 19:13:35 +00:00
Chih-Hung Hsieh 41d29b15e8 [clang-tidy] Add a close-on-exec check on epoll_create() in Android module.
Summary:
epoll_create() is better to be replaced by epoll_create1() with EPOLL_CLOEXEC
flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35367

llvm-svn: 311029
2017-08-16 18:02:49 +00:00
Chih-Hung Hsieh 3be4ecb15b [clang-tidy] Add a close-on-exec check on epoll_create1() in Android module.
Summary:
epoll_create1() is better to set EPOLL_CLOEXEC flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35365

llvm-svn: 311028
2017-08-16 17:53:12 +00:00
Chih-Hung Hsieh 5ac20c9c25 [clang-tidy] Add a close-on-exec check on accept4() in Android module.
Summary:
accept4() is better to set SOCK_CLOEXEC flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35363

llvm-svn: 311027
2017-08-16 17:46:18 +00:00
Chih-Hung Hsieh ae3527e6bb [clang-tidy] Add a close-on-exec check on accept() in Android module.
Summary:
accept() is better to be replaced by accept4() with SOCK_CLOEXEC
flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35362

llvm-svn: 311024
2017-08-16 17:18:16 +00:00
Chih-Hung Hsieh fec506daaa [clang-tidy] Use CloexecCheck as base class.
Summary:
Simplify registerMatchers and check functions in CloexecCreatCheck,
CloexecSocketCheck, CloexecFopenCheck, and CloexecOpenCheck.

Differential Revision: https://reviews.llvm.org/D36761

llvm-svn: 311020
2017-08-16 16:59:26 +00:00
Chih-Hung Hsieh 7651e66cdf [clang-tidy] Add a close-on-exec check on inotify_init1() in Android module.
Summary:
inotify_init1() is better to set IN_CLOEXEC flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35368

llvm-svn: 310863
2017-08-14 17:45:48 +00:00
Chih-Hung Hsieh 2e6f9a16f9 [clang-tidy] Add a close-on-exec check on inotify_init() in Android module.
Summary:
inotify_init() is better to be replaced by inotify_init1() with IN_CLOEXEC flag to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35370

llvm-svn: 310861
2017-08-14 17:25:41 +00:00
Chih-Hung Hsieh 56650e7fc5 [clang-tidy] Add a close-on-exec check on dup() in Android module.
Summary:
dup() is better to be replaced by fcntl() to avoid file descriptor leakage.

Differential Revision: https://reviews.llvm.org/D35364

llvm-svn: 310858
2017-08-14 17:04:16 +00:00
Simon Pilgrim 0f311a4189 Add braces to silence gcc dangling-else warnings. NFCI.
llvm-svn: 310830
2017-08-14 11:05:56 +00:00
Ilya Biryukov db8b2d7b20 [clangd] Use multiple working threads in clangd.
Reviewers: bkramer, krasimir, klimek

Reviewed By: klimek

Subscribers: arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D36261

llvm-svn: 310821
2017-08-14 08:45:47 +00:00
Ilya Biryukov 91dbf5b6b4 [clangd] Check if CompileCommand has changed on forceReparse.
Reviewers: krasimir, bkramer, klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36398

llvm-svn: 310819
2017-08-14 08:37:32 +00:00
Ilya Biryukov c5ad35fb23 [clangd] Fixed a data race.
Summary:
Calling addDocument after removeDocument could have resulted in an
invalid program state (AST and Preamble for the valid document could
have been incorrectly removed).
This commit also includes an improved CppFile::cancelRebuild
implementation that allows to cancel reparse without waiting for
ongoing rebuild to finish.

Reviewers: krasimir, bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36397

llvm-svn: 310818
2017-08-14 08:17:24 +00:00
Simon Pilgrim 7c87ebf3cd Fix Wdocumentation warning - typo in argument list. NFCI.
llvm-svn: 310783
2017-08-12 18:50:53 +00:00
Aaron Ballman 9253e89e47 Enable exceptions for this test case to speculatively fix the build bots.
Hopefully corrects: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/15666

llvm-svn: 310732
2017-08-11 16:46:45 +00:00
Aaron Ballman a3274e5443 Add hicpp-exception-baseclass to the HIC++ module.
This enforces that throwing an exception in C++ requires that exception to inherit from std::exception.

Patch by Jonas Toth.

llvm-svn: 310727
2017-08-11 16:31:51 +00:00
Aaron Ballman 6c2920a30a Implement hicpp-braces-around-statements as an alias to readability-braces-around-statements.
Patch by Jonas Toth.

llvm-svn: 310707
2017-08-11 12:12:36 +00:00
Yan Wang b21739f988 [clang-tidy] Fix for buildbot.
Summary:
Fix an issue for windows.

Differential Revision: https://reviews.llvm.org/D35372

llvm-svn: 310669
2017-08-10 22:09:22 +00:00
Reid Kleckner 8d4d57035f Revert "[clang-tidy] Refactor the code and add a close-on-exec check on memfd_create() in Android module."
This reverts commit r310630.

The new code broke on Windows and was untested. On Linux, it was
selecting the "int" overload of operator<<, which definitely does not
print the right thing when fed a "Mode" char.

llvm-svn: 310661
2017-08-10 21:21:15 +00:00
Yan Wang acd70d3c6b [clang-tidy] Fix a buildbot.
Fix format in ReleaseNotes.rst.

llvm-svn: 310643
2017-08-10 18:19:40 +00:00
Yan Wang d61c2a18cb [clang-tidy] Refactor the code and add a close-on-exec check on memfd_create() in Android module.
Summary:
1. Refactor the structure of the code by adding a base class for all close-on-exec checks, which implements most of the needed functions.
2. memfd_create() is better to set MFD_CLOEXEC flag to avoid file descriptor leakage.

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh, hokein

Subscribers: Eugene.Zelenko, chh, cfe-commits, srhines, mgorny, JDevlieghere, xazax.hun

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D35372

llvm-svn: 310630
2017-08-10 17:18:10 +00:00
Gabor Horvath 0b16c10de3 [clang-tidy] Add integer division check
Patch by: Reka Nikolett Kovacs

Differential Revision: https://reviews.llvm.org/D35932

llvm-svn: 310589
2017-08-10 13:30:30 +00:00
Alexander Kornienko 83eae8724e [clang-tidy] Updated docs and release notes for r310584
llvm-svn: 310587
2017-08-10 12:54:05 +00:00
Alexander Kornienko a4d94689fc [clang-tidy] Add a test.
llvm-svn: 310586
2017-08-10 12:38:46 +00:00
Alexander Kornienko 57fd153c46 [clang-tidy] Enable test for http://llvm.org/PR26228
llvm-svn: 310585
2017-08-10 12:24:52 +00:00
Alexander Kornienko ff6b2af499 [clang-tidy] Add modernize-use-emplace.IgnoreImplicitConstructors option
llvm-svn: 310584
2017-08-10 12:19:05 +00:00
Haojian Wu b7a3856538 [clang-tidy] Fix an error in the doc.
llvm-svn: 310578
2017-08-10 10:15:48 +00:00
Haojian Wu 75de614684 [clang-tidy] add forwarders in the aliased checks from hicpp module
Summary: Adds redirections notes and the actual redirections in the documentation for hicpp

Patch by: Jonas Toth

Reviewers: aaron.ballman, hokein, alexfh

Reviewed By: aaron.ballman, hokein

Subscribers: JDevlieghere, xazax.hun

Differential Revision: https://reviews.llvm.org/D36355

llvm-svn: 310577
2017-08-10 10:12:31 +00:00
Gabor Horvath 875ccc5864 [clang-tidy] Fix a check-fixes line
llvm-svn: 310560
2017-08-10 09:29:39 +00:00
Gabor Horvath aa660b5149 [clang-tidy] Minor documentation improvement
Patch by: Lilla Barancsuk

llvm-svn: 310559
2017-08-10 09:13:26 +00:00
Haojian Wu 6e596e2938 [clang-tidy] Add missing doc in cppcoreguidelines-c-copy-assignment-signature check.
llvm-svn: 310558
2017-08-10 09:12:32 +00:00
Benjamin Kramer 1436192d68 [clang-tidy] Don't compute the edit distance if it's over the threshold.
No functional change intended.

llvm-svn: 310532
2017-08-09 22:09:29 +00:00
Haojian Wu be5d4487b4 [clang-tidy] Fix another crash in make-unique check.
Summary:
The crash happens when calling `reset` method without any preceding
operation like "->" or ".", this could happen in a subclass of the
"std::unique_ptr".

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36452

llvm-svn: 310496
2017-08-09 17:03:42 +00:00
Alexander Kornienko 9b8df6ae02 [clang-tidy] Ignore newlines in checks list
This is a follow up to https://reviews.llvm.org/D30567 where I overlooked that
LLVM YAML parser doesn't support multiline literal folding.

llvm-svn: 310491
2017-08-09 16:00:31 +00:00
Ilya Biryukov c22824a6fc [clangd] Fixed a bug in make_tagged.
It accidentally std::move'd from Value parameter if it deduced to an
l-value ref.

llvm-svn: 310470
2017-08-09 12:55:13 +00:00
Gabor Horvath 40b6512d9e [clang-tidy] Add new readability non-idiomatic static access check
Patch by: Lilla Barancsuk

Differential Revision: https://reviews.llvm.org/D35937

llvm-svn: 310371
2017-08-08 15:33:48 +00:00
Alexander Kornienko f1a6552a95 [clang-tidy] 'implicit cast' -> 'implicit conversion'
Summary:
This patch renames checks, check options and changes messages to use correct
term "implicit conversion" instead of "implicit cast" (which has been in use in
Clang AST since ~10 years, but it's still technically incorrect w.r.t. C++
standard).

  * performance-implicit-cast-in-loop -> performance-implicit-conversion-in-loop
  * readability-implicit-bool-cast -> readability-implicit-bool-conversion
    - readability-implicit-bool-cast.AllowConditionalIntegerCasts ->
      readability-implicit-bool-conversion.AllowIntegerConditions
    - readability-implicit-bool-cast.AllowConditionalPointerCasts ->
      readability-implicit-bool-conversion.AllowPointerConditions

Reviewers: hokein, jdennett

Reviewed By: hokein

Subscribers: mgorny, JDevlieghere, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36456

llvm-svn: 310366
2017-08-08 14:53:52 +00:00
Florian Gross fa857b174d [clang-tidy] Added clang-tidy test cases related to rL310095
Differential Revision: https://reviews.llvm.org/D36308

llvm-svn: 310096
2017-08-04 19:01:56 +00:00
Haojian Wu 6a030d1bbf [clang-tidy] Add missing documents for "IgnoreMacros" option.
llvm-svn: 310051
2017-08-04 11:25:05 +00:00