Commit Graph

2195 Commits

Author SHA1 Message Date
Ehsan Akhgari 3bceebb0e0 [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh, klimek, bkramer

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 294491
2017-02-08 17:50:24 +00:00
Alexander Kornienko 385c2a3134 [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()
hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about
errors that lead to invalid AST.

llvm-svn: 294467
2017-02-08 16:11:22 +00:00
Alexander Kornienko bb64200e16 [clang-tidy] Supresses misc-move-constructor-init warning for const fields.
Patch by CJ DiMeglio!

Differential revision: https://reviews.llvm.org/D28973

llvm-svn: 294459
2017-02-08 14:56:16 +00:00
Benjamin Kramer f86708dbf5 [clangd] Strip file:// from the URI when calling formatting.
It confuses FileManager on windows.

llvm-svn: 294314
2017-02-07 16:10:17 +00:00
Benjamin Kramer d115a574b5 [clangd] Ignore comments in clangd input, so we can write tests without sed.
Another attempt on making this work on windows.

llvm-svn: 294312
2017-02-07 15:37:17 +00:00
Benjamin Kramer 81f91c1777 [clangd] Fix subtle use after return.
I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.

llvm-svn: 294309
2017-02-07 14:35:09 +00:00
Simon Pilgrim 24f1d340b3 Disable test on windows buildbots without shell support
llvm-svn: 294299
2017-02-07 13:08:22 +00:00
Benjamin Kramer 6a3d74eb50 [clangd] Set stdin to binary to fix tests on windows.
llvm-svn: 294297
2017-02-07 12:40:59 +00:00
Benjamin Kramer d588b0f525 [clangd] Harden test against sed implementations that strip \r.
Also clean up logging and don't print \0.

llvm-svn: 294294
2017-02-07 11:49:03 +00:00
Alexander Kornienko 258d9a528e [clang-tidy] misc-argument-comment - extended gmock support
It looks like direct calls to mocked methods happen in the wild. This patch
add support for these as well.

llvm-svn: 294293
2017-02-07 11:39:56 +00:00
Benjamin Kramer 59542bb08a [clangd] Add missing include.
llvm-svn: 294292
2017-02-07 10:47:40 +00:00
Benjamin Kramer bb1cdb63e5 Add a prototype for clangd
clangd is a language server protocol implementation based on clang. It's
supposed to provide editor integration while not suffering from the
confined ABI of libclang.

This implementation is limited to the bare minimum functionality of
doing (whole-document) formatting and rangeFormatting. The JSON parsing
is based on LLVM's YAMLParser but yet most of the code of clangd is
currently dealing with JSON serialization and deserialization.

This was only tested with VS Code so far, mileage with other LSP clients
may vary.

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

llvm-svn: 294291
2017-02-07 10:28:20 +00:00
Jonathan Coe 5f1a2c2e0a [clang-tidy] Cleanup of no-assembler check
Address outstanding comments from https://reviews.llvm.org/D29267

llvm-svn: 294283
2017-02-07 06:19:38 +00:00
Jonathan Coe 3032d3c3f3 [clang-tidy] safety-no-assembler
Summary:
Add a new clang-tidy module for safety-critical checks.

Include a check for inline assembler.

Reviewers: Prazek, dtarditi, malcolm.parsons, alexfh, aaron.ballman, idlecode

Reviewed By: idlecode

Subscribers: idlecode, JonasToth, Eugene.Zelenko, mgorny, JDevlieghere, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 294255
2017-02-06 22:57:14 +00:00
Alexander Kornienko d9fa4e95ec [clang-tidy] misc-argument-comment support for gmock
Now for real. The use case supported previously is used by approximately nobody.
What's needed is support for matching argument comments in EXPECT_xxx calls to
the names of parameters of the mocked methods.

llvm-svn: 294193
2017-02-06 15:47:17 +00:00
Alexander Kornienko 2d73022122 [clang-tidy] getPreviousNonCommentToken -> getPreviousToken
llvm-svn: 294192
2017-02-06 15:46:33 +00:00
Eric Liu 28c30ce250 [change-namespace] trying to fix build bot failure caused by r293909.
llvm-svn: 293927
2017-02-02 19:46:12 +00:00
Eric Liu 0325a77c5b [change-namespace] fix unscoped enum constant references.
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 293909
2017-02-02 17:40:38 +00:00
Eric Liu ae7de7117a [change-namespace] check using shadow decl correctly when shortening namespace specifiers.
Summary:
This fixes mismatch between template decls and template specialization decls.

Also added a few more test cases.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 293897
2017-02-02 15:29:54 +00:00
Alexander Kornienko 73c69a3714 [clang-tidy] misc-argument-comment support for gmock
llvm-svn: 293845
2017-02-02 00:37:08 +00:00
Alexander Kornienko 165fe63b4e [clang-tidy] misc-argument-comment: ignore comments after arguments
llvm-svn: 293771
2017-02-01 15:28:25 +00:00
Alexander Kornienko b7a6ea3049 [clang-tidy] Remove debug logging.
llvm-svn: 293763
2017-02-01 12:41:34 +00:00
Diana Picus 9141501721 Revert "Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications."
This reverts commit r293217, its follow-up 293218 and part of 293234 because it
broke all bots that build clang-tools-extra.

llvm-svn: 293267
2017-01-27 07:19:22 +00:00
Eugene Zelenko 834bb0e3b5 [Clang-tidy documentation] Consistency (fix-it); 80 characters per line.
llvm-svn: 293234
2017-01-26 23:58:21 +00:00
Aaron Ballman abb5b7965a Correcting a typo in the test case to appease bots.
llvm-svn: 293218
2017-01-26 22:39:01 +00:00
Aaron Ballman 8ec373af3d Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications.
Patch by Don Hinton.

llvm-svn: 293217
2017-01-26 22:34:24 +00:00
Eric Liu 9122916ee5 [change-namespace] correctly shorten namespace when references have leading '::'
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 293187
2017-01-26 16:31:32 +00:00
Eric Liu bc715504da [change-namespace] add leading '::' to references in new namespace when name conflict is possible.
Summary:
For example, when we change 'na' to "nb::nc", we need to add leading '::' to
references "::nc::X" in the changed namespace.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 293182
2017-01-26 15:08:44 +00:00
Gabor Horvath 3ac2ad7d6c [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.
Fixes PR30964. The old behavior can be achieved using a setting.

Patch by: Andras Leitereg!

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

llvm-svn: 292938
2017-01-24 15:18:11 +00:00
Alexander Kornienko 2e888fe165 [clang-tidy] Fix NOLINT test
Summary:
Test cases I've added in review D26218 were too brittle and weren't working properly.
This patch fixes this.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Nikita Kakuev!

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

llvm-svn: 292926
2017-01-24 12:42:26 +00:00
Alexander Kornienko 4b1dfbbc78 [clang-tidy] Avoid incorrect fixes in modernize-use-using
Avoid fixes for typedefs with multiple types and for typedefs with struct
definitions. Partially addresses http://llvm.org/PR28334

llvm-svn: 292918
2017-01-24 11:41:02 +00:00
Alexander Kornienko c456e686a9 [clang-tidy] Add more tests for modernize-use-using.
llvm-svn: 292917
2017-01-24 11:40:23 +00:00
Malcolm Parsons 3de05a2fda [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
Summary:
The performance-unnecessary-value-param check mangled inherited
constructors, as the constructors' parameters do not have useful source
locations. Fix this by ignoring implicit functions.

Fixes PR31684.

Reviewers: flx, alexfh, aaron.ballman

Subscribers: madsravn, JDevlieghere, cfe-commits

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

llvm-svn: 292786
2017-01-23 13:18:08 +00:00
Felix Berger 08df246407 [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check
Reviewers: alexfh, sbenza, malcolm.parsons

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 292491
2017-01-19 15:51:10 +00:00
Malcolm Parsons 9cfb973ab4 [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing
Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

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

llvm-svn: 292484
2017-01-19 13:38:19 +00:00
Ehsan Akhgari 221ab77ff7 [clang-tidy] Add -extra-arg and -extra-arg-before to run-clang-tidy.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh

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

llvm-svn: 292415
2017-01-18 17:49:35 +00:00
Benjamin Kramer 1d3a91a682 [include-fixer] Don't return a correction if the header insertion failed.
This is could happen in cases involving macros and we don't want to
return an invalid fixit for it or a confusing error message with no
fixit.

llvm-svn: 292405
2017-01-18 16:22:58 +00:00
Alexander Kornienko 0d7a7cdb28 [clang-tidy] Fix crash in modernize-use-using (http://llvm.org/PR29135)
llvm-svn: 292229
2017-01-17 16:14:03 +00:00
Haojian Wu 903d35e50e Remove dead code.
llvm-svn: 292218
2017-01-17 13:46:59 +00:00
Haojian Wu 4775ce56ec [clang-move] Handle helpers with forward declarations.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 292215
2017-01-17 13:22:37 +00:00
Haojian Wu b3d9888449 [clang-move] Ignore using decls which are defined in macros.
Summary:
Also ignore helpers which are defined in macro. Currently clang-move doesn't
handle macro well enough, especiall for complex macros. This patch will ignore
declarations in macros to make the behavior of clang-move more correct.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 292207
2017-01-17 10:08:11 +00:00
Antonio Maiorano 0d7d9c20a5 Update tools to use new getStyle API
Depends on https://reviews.llvm.org/D28081

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

llvm-svn: 292175
2017-01-17 00:13:32 +00:00
Haojian Wu 85867727fa [clang-move] Dump enum and type alias declarations.
Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 292098
2017-01-16 09:34:07 +00:00
Malcolm Parsons e65b1029ca Remove unused lambda captures. NFC
llvm-svn: 291941
2017-01-13 19:02:50 +00:00
Malcolm Parsons 3c3ae0e6db Remove unused lambda captures. NFC
llvm-svn: 291940
2017-01-13 18:56:04 +00:00
Benjamin Kramer 5f1f6eceb3 Fix the build of the include-fixer plugin for some shared cmake builds and MSVC.
- The include fixer plugin does not directly depend on pthread, but can
pick up pthread references transitively through inlining. Just add
pthreads to the linked libs unconditionally.
- MSVC emits bogus warnings when including <future> and building without
exceptions. Blacklist the warnings explicitly.

llvm-svn: 291892
2017-01-13 10:14:07 +00:00
Hans Wennborg 07e66ad7f8 Clear the release notes for 5.0.0
llvm-svn: 291838
2017-01-12 21:58:40 +00:00
Hans Wennborg 73c01543ec Update docs/conf.py version
llvm-svn: 291832
2017-01-12 21:42:38 +00:00
Malcolm Parsons 6b3e27219e [clang-tidy] Fix check for trivially copyable types in modernize-pass-by-value
Summary:
rL270567 excluded trivially copyable types from being moved by
modernize-pass-by-value, but it didn't exclude references to them.
Change types used in the tests to not be trivially copyable.

Reviewers: madsravn, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 291796
2017-01-12 19:20:35 +00:00
Alexander Kornienko e3d91a5c4b Correctly classify main file includes if there is a prefix added
Summary:
Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory).

This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code.

Reviewers: hokein, alexfh

Subscribers: cfe-commits, #clang-tools-extra

Patch by Julian Bangert!

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

llvm-svn: 291767
2017-01-12 15:31:50 +00:00