Commit Graph

777 Commits

Author SHA1 Message Date
Daniel Sanders 5b4f640499 [clang-tidy] Add llvm-prefer-register-over-unsigned to clang-tidy
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Reviewers: arsenm, bogner

Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, mgorny, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 370512
2019-08-30 20:01:59 +00:00
Sam McCall 9004c077c0 [clang-tidy] readability-identifier-naming shouldn't complain about CRTP pseudo-overrides
Reviewers: ilya-biryukov

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 370193
2019-08-28 12:08:57 +00:00
Alex Lorenz 559ae14c9b Remove clang-tidy-vs from clang-tools-extra (PR41791)
The clang-tidy-vs visual studio plugin in clang-tools-extra contains a
security vulnerability in the YamlDotNet package [1]. I posted to cfe-dev [2],
asking if there was anyone who was interested in updating the the plugin
to address the vulnerability. Reid mentioned that Zach (the original committer),
said that there's another plugin (Clang Power Tools) that provides clang-tidy support,
with additional extra features, so it would be ok to remove clang-tidy-vs.

This commit removes the plugin to address the security vulnerability, and adds
a section to the release notes that mentions that the plugin was removed, and
suggests to use Clang Power Tools.

Fixes PR 41791.

[1]: https://nvd.nist.gov/vuln/detail/CVE-2018-1000210
[2]: http://lists.llvm.org/pipermail/cfe-dev/2019-August/063196.html

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

llvm-svn: 370096
2019-08-27 18:36:08 +00:00
Sam McCall 049bb913e2 Revert "[clangd] Release notes" (wrong branch)
This reverts commit 51029e5c15.

llvm-svn: 370022
2019-08-27 06:58:05 +00:00
Sam McCall 51029e5c15 [clangd] Release notes
llvm-svn: 369934
2019-08-26 17:47:44 +00:00
Kadir Cetinkaya 3877aa1660 [clangd] Fix docs
llvm-svn: 369920
2019-08-26 16:01:07 +00:00
Kadir Cetinkaya 3aeed0fd5a [clangd] Add docs for configuration knobs in clangd
Summary:
This is a first step in documenting different configuration knobs we
have in clangd.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 369917
2019-08-26 15:42:16 +00:00
Yuanfang Chen 08ff5df49c Fix documentation build after rL369568
llvm-svn: 369578
2019-08-21 20:59:16 +00:00
Yuanfang Chen f24c1e6b51 [clang-tidy] Check for dynamically initialized statics in headers.
Finds instances where variables with static storage are initialized dynamically in header files.

Reviewed By: aaron.ballman, alexfh

Patch by Charles Zhang!

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

llvm-svn: 369568
2019-08-21 20:00:01 +00:00
Nathan Ridge dfe5f3eb0a [clangd] Update features table in the docs with links to LSP extension proposals
Also update the semantic coloring entry to reflect it being supported in
clangd now.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369229
2019-08-19 05:11:15 +00:00
Diego Astiazaran 3550da79ec [clang-doc] Redesign of generated HTML files
The new design includes a header (contains the project name), a main section, and a footer.
The main section is divided into three subsections. Left, middle, right. The left section contains the general index, the middle contains the info's data, and the right contains the index for the info's content.
The CSS has been updated.
A flag --project-name is added.
The Attributes attribute of the TagNode struct is now a vector of pairs because these attributes should be rendered in the insertion order.
The functions (cpp and js) that converts an Index tree structure into HTML were slightly modified; the first ul tag created is now a ol tag. The inner lists are still ul.

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

llvm-svn: 369139
2019-08-16 18:38:11 +00:00
Diego Astiazaran 665e9676c2 [clang-format] Add link to source code in file definitions
Two command line options have been added to clang-doc.
  --repository=<string>       - URL of repository that hosts code; used for links to definition locations.
  --source-root=<string>      - Directory where processed files are stored. Links to definition locations will only be generated if the file is in this dir.

If the file is in the source-root and a repository options is passed;
a link to the source code will be rendered by the HTML generator.

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

llvm-svn: 368460
2019-08-09 17:49:41 +00:00
Diego Astiazaran 7900905f76 [clang-doc] Update documentation
HTML generator has been included in clang-tools-extra release notes.
clang-doc documentation file has been updated.

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

llvm-svn: 367743
2019-08-03 02:18:06 +00:00
Nathan Huckleberry 6722923c38 [clang-tidy] Adding static analyzer check to list of clang-tidy checks
Summary:
Since clang-tidy supports use of the static analyzer there
should be documentation of how to invoke the static analyzer
checks.

Reviewers: JonasToth, aaron.ballman, NoQ, Szelethus

Reviewed By: aaron.ballman

Subscribers: nickdesaulniers, lebedev.ri, jfb, NoQ, Eugene.Zelenko, xazax.hun, baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

llvm-svn: 367694
2019-08-02 17:18:31 +00:00
JF Bastien e825b834ec [NFC] Remove LLVM_ALIGNAS
Summary: The minimum compilers support all have alignas, and we don't use LLVM_ALIGNAS anywhere anymore. This also removes an MSVC diagnostic which, according to the comment above, isn't relevant anymore.

Reviewers: rnk

Subscribers: mgorny, jkorous, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 367383
2019-07-31 03:22:08 +00:00
Tom Roeder 61493df7c6 [clang-tidy] Fix the documentation for linuxkernel-must-use-errs.
Summary:
This changes ReleaseNotes.txt to have the first sentence of the full
documentation from linuxkernel-must-use-errs.rst.

This addresses a comment from the review of rL367071 in
https://reviews.llvm.org/D59963.

Reviewers: Eugene.Zelenko

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 367333
2019-07-30 16:49:28 +00:00
Eric Fiselier a2a6f85366 [clang-tidy]: Google: new check 'google-upgrade-googletest-case'
Introduce a new check to upgrade user code based on API changes in Googletest.

The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite".

Patch by Alex Strelnikov (strel@google.com)
Reviewed as D62977.

llvm-svn: 367263
2019-07-29 21:38:56 +00:00
Tom Roeder fc8c65b2e1 [clang-tidy] Add a module for the Linux kernel.
Summary:
Now that clang is going to be able to build the Linux kernel again on
x86, and we have gen_compile_commands.py upstream for generating
compile_commands.json, clang-tidy can be used on the Linux kernel
source.

To that end, this commit adds a new clang-tidy module to be used for
checks specific to Linux kernel source. The Linux kernel follows its own
style of C, and it will be useful to separate those checks into their
own module.

This also adds an initial check that makes sure that return values from
the kernel error functions like PTR_ERR and ERR_PTR are checked. It also
makes sure that any functions that directly return values from these
functions are checked.

Subscribers: xazax.hun, gribozavr, Eugene.Zelenko, lebedev.ri, mgorny, jdoerfert, cfe-commits

Tags: #clang, #clang-tools-extra

Reviewers: aaron.ballman, alexfh, hokein, JonasToth

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

llvm-svn: 367071
2019-07-25 22:32:50 +00:00
Aaron Ballman 5418be85e8 Update documentation for all CERT checks that correspond to a recommendation.
CERT removed their C++ secure coding recommendations from public view and so the links within that documentation are stale. This updates various pieces of documentation to make this more clear, and to help add substance where our docs deferred to CERT's wiki.

llvm-svn: 366687
2019-07-22 13:22:08 +00:00
Hans Wennborg 8f5b44aead Bump the trunk version to 10.0.0svn
and clear the release notes.

llvm-svn: 366427
2019-07-18 11:51:05 +00:00
Hans Wennborg 5dd86ab2dd clang-tidy release notes: Split and order changes by type
Patch by Eugene Zelenko!

llvm-svn: 366408
2019-07-18 07:12:47 +00:00
Matthias Gehre ffca322266 [clang-tidy] initial version of readability-convert-member-functions-to-static
Summary:
Finds non-static member functions that can be made ``static``.

I have run this check (repeatedly) over llvm-project. It made 1708 member functions
``static``. Out of those, I had to exclude 22 via ``NOLINT`` because their address
was taken and stored in a variable of pointer-to-member type (e.g. passed to
llvm::StringSwitch).
It also made 243 member functions ``const``. (This is currently very conservative
to have no false-positives and can hopefully be extended in the future.)

You can find the results here: https://github.com/mgehre/llvm-project/commits/static_const_eval

Reviewers: alexfh, aaron.ballman

Subscribers: mgorny, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 366265
2019-07-16 21:19:00 +00:00
Kadir Cetinkaya 1d91f94f09 [clangd] Fix doc
llvm-svn: 366073
2019-07-15 15:16:57 +00:00
Nathan Ridge d1fdadb226 [clangd] Mark type hierarchy as a supported feature in the docs
Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 365987
2019-07-13 03:24:54 +00:00
Dmitri Gribenko ede514049a Fixed a link in ReleaseNotes.rst (follow-up to r365007)
llvm-svn: 365078
2019-07-03 20:18:34 +00:00
Dmitri Gribenko e6020f5c62 [clang-tidy] new check: bugprone-posix-return
Summary:
Checks if any calls to posix functions (except posix_openpt) expect negative return values.
These functions return either 0 on success or an errno on failure, which is positive only.

Reviewers: JonasToth, gribozavr, alexfh, hokein

Reviewed By: gribozavr

Subscribers: Eugene.Zelenko, lebedev.ri, llozano, george.burgess.iv, xazax.hun, srhines, mgorny, cfe-commits

Tags: #clang

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

Patch by Jian Cai.

llvm-svn: 365007
2019-07-03 09:20:18 +00:00
Alexander Kornienko b101c39f58 Fixed two issues in clang-tidy -help.
HeaderFilter -> HeaderFilterRegex

llvm-svn: 364837
2019-07-01 18:55:10 +00:00
Nikolai Kosjar 181f252d53 [clang-tidy] Update documentation for Qt Creator integration.
Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 364315
2019-06-25 13:50:09 +00:00
Haojian Wu 38a2f50070 [clang-tidy] Fix a typo in the doc.
llvm-svn: 364010
2019-06-21 07:58:19 +00:00
Julie Hockett d9b3d08a9a [clang-tidy] Split fuchsia-default-arguments
Splits fuchsia-default-arguments check into two checks. fuchsia-default-arguments-calls warns if a function or method is called with default arguments. fuchsia-default-arguments-declarations warns if a function or method is declared with default parameters.

Committed on behalf of @diegoast (Diego Astiazarán).

Resolves b38051.

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

llvm-svn: 363712
2019-06-18 18:07:33 +00:00
Don Hinton 9d8c94dfd7 [docs] Fix another bot warning by adding a blank line to separate the `option::` command from the text below.
llvm-svn: 363520
2019-06-16 18:41:31 +00:00
Don Hinton 3a92aa2999 [docs] Fix a few problems with clang-tool docs to get the bots green again.
llvm-svn: 363518
2019-06-16 17:57:37 +00:00
George Burgess IV 5b2a85d0de android: add a close-on-exec check on pipe()
On Android, pipe() is better to be replaced by pipe2() with O_CLOEXEC
flag to avoid file descriptor leakage.

Patch by Jian Cai!

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

llvm-svn: 362673
2019-06-06 05:21:45 +00:00
George Burgess IV 3da331b456 android: add a close-on-exec check on pipe2()
On Android, pipe2() is better to set O_CLOEXEC flag to avoid file
descriptor leakage.

Patch by Jian Cai!

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

llvm-svn: 362672
2019-06-06 05:21:39 +00:00
Simon Pilgrim c472f7b010 Fix sphinx "Malformed option description" warning
llvm-svn: 361616
2019-05-24 09:31:32 +00:00
Matthias Gehre b087129b5d [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init
Differential Revision: D24892

llvm-svn: 361601
2019-05-24 05:46:57 +00:00
Tamas Zolnai dab31924e9 [clang-tidy]: Add cert-oop54-cpp alias for bugprone-unhandled-self-assignment
Summary:
Added WarnOnlyIfThisHasSuspiciousField option to allow
to catch any copy assignment operator independently from
the container class's fields.
Added the cert alias using this option.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

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

Tags: #clang

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

llvm-svn: 361550
2019-05-23 20:29:04 +00:00
Simon Pilgrim 30905a375e Fix sphinx unknown document error
llvm-svn: 361545
2019-05-23 20:07:27 +00:00
Dmitri Gribenko 1520dafa20 [clang-tidy] New check calling out uses of +new in Objective-C code
Summary:
Google's Objective-C style guide forbids calling or overriding +new to instantiate objects. This check warns on violations.

Style guide reference: https://google.github.io/styleguide/objcguide.html#do-not-use-new

Patch by Michael Wyman.

Reviewers: benhamilton, aaron.ballman, JonasToth, gribozavr, ilya-biryukov, stephanemoore, mwyman

Reviewed By: aaron.ballman, gribozavr, stephanemoore, mwyman

Subscribers: stephanemoore, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 361487
2019-05-23 12:01:26 +00:00
Adam Balogh 5f3deb9bb5 [clang-tidy] New option for misc-throw-by-value-catch-by-reference
Catching trivial objects by value is not dangerous but may be
inefficient if they are too large. This patch adds an option
`WarnOnLargeObject` to the checker to also warn if such an object
is caught by value. An object is considered as "large" if its
size is greater than `MaxSize` which is another option. Default
value is the machine word of the architecture (size of the type
`size_t`).

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

llvm-svn: 361225
2019-05-21 07:25:06 +00:00
Don Hinton 4c50e64fc5 [clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with correct attribution
Summary:
modernize-loop-convert was not detecting implicit casts to
const_iterator as convertible to range-based loops:

    std::vector<int> vec{1,2,3,4}
    for(std::vector<int>::const_iterator i = vec.begin();
        i != vec.end();
        ++i) { }

Thanks to Don Hinton for advice.

As well, this change adds a note for this check's applicability to code
targeting OpenMP prior version 5 as this check will continue breaking
compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this
out.

Fixes PR#35082

Patch by Torbjörn Klatt!

Reviewed By: hintonda

Tags: #clang-tools-extra, #clang

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

llvm-svn: 360788
2019-05-15 17:47:51 +00:00
Don Hinton 4ecb581188 Revert [clang-tidy] modernize-loop-convert: impl const cast iter
This reverts r360785 (git commit 42d28be802)

llvm-svn: 360787
2019-05-15 17:36:54 +00:00
Don Hinton 42d28be802 [clang-tidy] modernize-loop-convert: impl const cast iter
Summary:
modernize-loop-convert was not detecting implicit casts to
const_iterator as convertible to range-based loops:

    std::vector<int> vec{1,2,3,4}
    for(std::vector<int>::const_iterator i = vec.begin();
        i != vec.end();
        ++i) { }

Thanks to Don Hinton for advice.

As well, this change adds a note for this check's applicability to code
targeting OpenMP prior to version 5 as this check will continue breaking
compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this
out.

Fixes PR#35082

Reviewed By: hintonda

Tags: #clang-tools-extra, #clang

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

llvm-svn: 360785
2019-05-15 16:58:58 +00:00
Kristof Umann 7f7dd09001 [clang-tidy] new check: bugprone-branch-clone
Implement a check for detecting if/else if/else chains where two or more
branches are Type I clones of each other (that is, they contain identical code)
and for detecting switch statements where two or more consecutive branches are
Type I clones of each other.

Patch by Donát Nagy!

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

llvm-svn: 360779
2019-05-15 15:06:25 +00:00
Tamas Zolnai de7a30cb0a [clang-tidy] new check: bugprone-unhandled-self-assignment
Summary:
This check searches for copy assignment operators which might not handle self-assignment properly. There are three patterns of
handling a self assignment situation: self check, copy-and-swap or the less common copy-and-move. The new check warns if none of
these patterns is found in a user defined implementation.

See also:
OOP54-CPP. Gracefully handle self-copy assignment
https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP54-CPP.+Gracefully+handle+self-copy+assignment

Reviewers: JonasToth, alexfh, hokein, aaron.ballman

Subscribers: riccibruno, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 360540
2019-05-12 12:23:56 +00:00
Aaron Ballman 61c0daa007 Recommit r360345 with fixes (was reverted in r360348).
Add the modernize-use-trailing-return check to rewrite function signatures to use trailing return types.

Patch by Bernhard Manfred Gruber.

llvm-svn: 360438
2019-05-10 16:24:28 +00:00
Aaron Ballman 0268083329 Revert r360345 and r360346, as they are not passing the testbots.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/48063/steps/test/logs/stdio

llvm-svn: 360348
2019-05-09 15:06:41 +00:00
Aaron Ballman f58a5c8803 Fixing a link in the release notes to appease the Sphinx bot.
llvm-svn: 360346
2019-05-09 15:00:38 +00:00
Aaron Ballman 8e015b2e94 Add the modernize-use-trailing-return check to rewrite function signatures to use trailing return types.
Patch by Bernhard Manfred Gruber.

llvm-svn: 360345
2019-05-09 14:48:17 +00:00
Artem Dergachev 9820d04dbc [clang-tidy] Update documentation on ReSharper integration.
It's now possible to set custom clang-tidy binary.

Patch by Alexander Zaitsev!

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

llvm-svn: 360277
2019-05-08 18:12:12 +00:00