Commit Graph

463 Commits

Author SHA1 Message Date
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
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 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
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
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 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
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
Haojian Wu 6a030d1bbf [clang-tidy] Add missing documents for "IgnoreMacros" option.
llvm-svn: 310051
2017-08-04 11:25:05 +00:00
Haojian Wu 115b707584 [clang-tidy] Ignore macros in make-unique check.
Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 310050
2017-08-04 11:18:00 +00:00
Hans Wennborg 1298fd907c Clear release notes for 6.0.0
llvm-svn: 308479
2017-07-19 14:15:27 +00:00
Hans Wennborg 25aedcc7b2 Bump docs version to 6.0
llvm-svn: 308467
2017-07-19 13:51:07 +00:00
Gabor Horvath 5aae773d86 [clang-tidy] Minor documentation fix. NFC.
llvm-svn: 308022
2017-07-14 12:31:21 +00:00
Gabor Horvath 46a9db45c6 [clang-tidy] Add bugprone-undefined-memory-manipulation check
Patch by: Reka Nikolett Kovacs

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

llvm-svn: 308021
2017-07-14 12:20:19 +00:00
Gabor Horvath 829e75a037 [clang-tidy] Add bugprone-suspicious-memset-usage check
Created new module bugprone and placed the check in that.

Finds memset() calls with potential mistakes in their arguments.
Replaces and extends the existing google-runtime-memset-zero-length check.

Cases covered:
* Fill value is a character '0'. Integer 0 might have been intended.
* Fill value is out of char range and gets truncated.
* Byte count is zero. Potentially swapped with the fill value argument.

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 308020
2017-07-14 12:15:55 +00:00
Yan Wang b38045d02e [clang-tidy] Add a new Android check "android-cloexec-socket"
Summary: socket() is better to include SOCK_CLOEXEC in its type argument to avoid the file descriptor leakage.

Reviewers: chh, Eugene.Zelenko, alexfh, hokein, aaron.ballman

Reviewed By: chh, alexfh

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

Tags: #clang-tools-extra

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

llvm-svn: 307818
2017-07-12 17:43:36 +00:00
Gabor Horvath 5314521328 [clang-tidy] Add new modernize use unary assert check
Patch by: Lilla Barancsuk

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

llvm-svn: 307791
2017-07-12 13:43:35 +00:00
Haojian Wu 040c0f96cc [clang-tidy] Add "MakeSmartPtrFunction" option to modernize-make-shared/unique checks.
Reviewers: alexfh, aaron.ballman

Reviewed By: alexfh

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

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

llvm-svn: 307130
2017-07-05 07:49:00 +00:00
Sylvestre Ledru f85b38f25e Fix some typos in the doc
llvm-svn: 306750
2017-06-29 22:26:06 +00:00
Yan Wang 600a6133ad [clang-tidy] Rename android-file-open-flag and fix a bug
Summary:
1. Rename android-file-open-flag to android-cloexec-open.
2. Handle a case when the function is passed as an argument of a function-like macro.

Reviewers: chh

Reviewed By: chh

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

Tags: #clang-tools-extra

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

llvm-svn: 306728
2017-06-29 19:13:29 +00:00
Yan Wang 7272f06a70 [clang-tidy] Add docs to toctree
Summary: Add .rst files to toctree. Fix buildbot error.

Reviewers: chh

Reviewed By: chh

Subscribers: srhines, JDevlieghere, xazax.hun

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

llvm-svn: 306719
2017-06-29 18:44:28 +00:00
Yan Wang 24340252a4 [clang-tidy][Part3] Add a new module Android and three new checks.
Summary: -- fopen() should include "e" in their mode string. [android-fopen-mode]

Reviewers: chh, alexfh, aaron.ballman, hokein

Reviewed By: hokein

Subscribers: JDevlieghere, srhines, mgorny, xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 306709
2017-06-29 17:42:23 +00:00
Yan Wang 0b97414707 [clang-tidy][Part2] Add a new module Android and three new checks
Summary: -- creat() should be replaced by open(). [android-creat-usage] 

Reviewers: chh, alexfh, aaron.ballman, hokein

Reviewed By: hokein

Subscribers: JDevlieghere, srhines, mgorny, xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 306708
2017-06-29 17:40:57 +00:00
Haojian Wu 6a3f5552cc [clang-tidy] follow-up on misc-definitions-in-header check.
Summary:
A follow-up on D34449:
* add `-std=c++11` to `.hpp` file by default.
* add constexpr function to test and doc.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 306650
2017-06-29 08:28:45 +00:00
Kirill Bobyrev 4621387d9d [clangd] Cleanup ClangdUnit.cpp, update docs; NFC
* Enforce 80 characters limit where appropriate
* Use slightly more descriptive names for searched locations
* Update docs to reflect D34269, which adds "Go To Declaration" functionality

llvm-svn: 306598
2017-06-28 20:57:28 +00:00
Gabor Horvath 2990ac1ebd [clang-tidy] Enable inline variable definitions in headers
Differential Revision: https://reviews.llvm.org/D34449

llvm-svn: 306538
2017-06-28 12:47:35 +00:00
Sylvestre Ledru 19d0ccaef3 Remove the script dump_check_docs.py. It was a one-shot migration script.
Sign off from Alexander Kornienko by email

llvm-svn: 306263
2017-06-26 02:56:57 +00:00
Yan Wang 0b0847b266 [clang-tidy] doc format fix
Summary: The url in the doc is wrong. Fix the url.

Reviewers: chh

Reviewed By: chh

Subscribers: srhines, xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 306172
2017-06-23 22:12:55 +00:00
Yan Wang 36206206cd [clang-tidy][Part1] Add a new module Android and three new checks.
Summary:
A common source of security bugs is code that opens a file descriptors without using the O_CLOEXEC flag.  (Without that flag, an opened sensitive file would remain open across a fork+exec to a lower-privileged SELinux domain, leaking that sensitive data.).

Add a new Android module and one checks in clang-tidy.
-- open(), openat(), and open64() should include O_CLOEXEC in their flags argument. [android-file-open-flag]

Links to part2 and part3:
https://reviews.llvm.org/D33745
https://reviews.llvm.org/D33747


Reviewers: chh, alexfh, aaron.ballman, hokein

Reviewed By: alexfh, hokein

Subscribers: jbcoe, joerg, malcolm.parsons, Eugene.Zelenko, srhines, mgorny, xazax.hun, cfe-commits, krytarowski

Tags: #clang-tools-extra

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

llvm-svn: 306165
2017-06-23 21:37:29 +00:00
Roman Lebedev a1cee29608 [clang-tidy] readability-function-size: add NestingThreshold param.
Summary:
Finds compound statements which create next nesting level after `NestingThreshold` and emits a warning.
Do note that it warns about each compound statement that breaches the threshold, but not any of it's sub-statements, to have readable warnings.

I was able to find only one coding style referencing nesting:
  - https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation
     > In short, 8-char indents make things easier to read, and have the added benefit of warning you when you’re nesting your functions too deep.

This seems too basic, i'm not sure what else to test. Are more tests needed?

Reviewers: alexfh, aaron.ballman, sbenza

Reviewed By: alexfh, aaron.ballman

Subscribers: xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 305082
2017-06-09 14:22:10 +00:00
Roman Lebedev 739b48399d [clang-tools-extra] ReleaseNotes.rst: test commit: whitespace fix
llvm-svn: 305067
2017-06-09 12:00:04 +00:00
Alexander Kornienko 08936e4740 [clang-tidy] New checker to replace dynamic exception specifications
Summary:
New checker to replace dynamic exception
specifications

This is an alternative to D18575 which relied on reparsing the decl to
find the location of dynamic exception specifications, but couldn't
deal with preprocessor conditionals correctly without reparsing the
entire file.

This approach uses D20428 to find dynamic exception specification
locations and handles all cases correctly.

Reviewers: aaron.ballman, alexfh

Reviewed By: aaron.ballman, alexfh

Subscribers: xazax.hun, mgehre, malcolm.parsons, mgorny, JDevlieghere, cfe-commits, Eugene.Zelenko, etienneb

Patch by Don Hinton!

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

llvm-svn: 304977
2017-06-08 14:04:16 +00:00
Alexander Kornienko 038aefdec5 Fix formatting in docs.
llvm-svn: 304581
2017-06-02 18:44:32 +00:00
Alexander Kornienko d9a4491b0a [clang-tidy] check for __func__/__FUNCTION__ in lambdas
Add a clang-tidy check for using func__/FUNCTION__ inside lambdas. This
evaluates to the string operator(), which is almost never useful and almost
certainly not what the author intended.

Patch by Bryce Liu!

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

llvm-svn: 304570
2017-06-02 17:36:32 +00:00
Miklos Vajna a0ce632079 clang-rename: add new -force option
Summary:
    The use-case is when renaming a widely used name, like a lower-level
    class in a codebase and clang-rename is simply invoked for each
    translation unit based on the compile database. In this case it's not
    interesting to show errors: not finding the symbol means there is
    simply nothing to do.

Reviewers: klimek

Reviewed By: klimek

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

llvm-svn: 304534
2017-06-02 09:32:28 +00:00
Eugene Zelenko eed5f028ee [Documentation] Mention hicpp check group in Clang-tidy main document.
llvm-svn: 303884
2017-05-25 17:22:29 +00:00