Commit Graph

1837 Commits

Author SHA1 Message Date
Alexander Droste 1512f9a0f9 [clang-tidy] MPIBufferDerefCheck
...
This check verifies if a buffer passed to an MPI (Message Passing Interface)
function is sufficiently dereferenced. Buffers should be passed as a single
pointer or array. As MPI function signatures specify void * for their buffer
types, insufficiently dereferenced buffers can be passed, like for example
as double pointers or multidimensional arrays, without a compiler warning
emitted.

Instructions on how to apply the check can be found at:
https://github.com/0ax1/MPI-Checker/tree/master/examples

Reviewers: Haojian Wu
Differential revision: https://reviews.llvm.org/D22729

llvm-svn: 278553
2016-08-12 19:30:31 +00:00
Zachary Turner 6a91af7eb7 Remove accidentally committed file.
llvm-svn: 278547
2016-08-12 18:39:05 +00:00
Zachary Turner 18cfbc4b8e Analyze include order on a per-file basis.
The include order check would get notified of all include
directives in a depth-first manner.  This created the
possibility of an include directive from a header file
interfering with the sort order of a set of two distinct
blocks from the top level cpp file, if that include directive
was on just the right line.

With this patch we bucket the include directives by the file
in which they appear in and process one bucket at a time,
so that directives from different files do not get mixed
together into the same list.

Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D23434

llvm-svn: 278546
2016-08-12 18:38:26 +00:00
Kirill Bobyrev c018e4d665 [clang-tidy] fix readability-else-after-return test
As pointed by Yung Douglas, exceptions in
test/clang-tidy/readability-else-after-return.cpp are causing PS4 bots to be
red, because exceptions aren't enabled by default on PS4 target. This patch is a
fix.

llvm-svn: 278324
2016-08-11 08:18:39 +00:00
Eugene Zelenko 3ed5011d51 [Documentation] Improve consistency.
Mention Clang-rename Emacs integration in release notes.

llvm-svn: 278295
2016-08-10 22:00:49 +00:00
Eugene Zelenko 9ef6b6b4f4 [Documentation] Fix style and grammar mistake in Clang-tidy readability-else-after-return description spotted by Alexander Kornienko.
llvm-svn: 278279
2016-08-10 19:49:38 +00:00
Eugene Zelenko 12b0acc727 [Documentation] Highlighting consistency and spelling mistake fix in Clang-tidy readability-else-after-return description.
llvm-svn: 278263
2016-08-10 18:30:14 +00:00
Eugene Zelenko cdfdb4f110 [Release Notes] Consistency in Clang-tidy entries' style.
llvm-svn: 278262
2016-08-10 18:15:51 +00:00
Kirill Bobyrev 34789edbbf [clang-tidy] enhance readability-else-after-return
`readability-else-after-return` only warns about `return` calls, but LLVM Coding
Standars stat that `throw`, `continue`, `goto`, etc after `return` calls are
bad, too.

Reviwers: alexfh, aaron.ballman

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

llvm-svn: 278257
2016-08-10 18:05:47 +00:00
Eugene Zelenko 7fa868b31d [Documentation] Fix grammar mistakes in docs/clang-tidy/index.rst spotted by Alexander Kornienko.
llvm-svn: 278255
2016-08-10 18:02:15 +00:00
Kirill Bobyrev 8694cb97c2 [clang-tidy] minor improvements in modernise-deprecated-headers check
This patch introduces a minor list of changes as proposed by Richard Smith in
the mailing list.

See original comments with an impact on the future check state below:

[comments.begin

> +                          {"complex.h", "ccomplex"},

It'd be better to convert this one to <complex>, or leave it alone.
<ccomplex> is an unnecessary wart.

(The contents of C++11's <complex.h> / <ccomplex> / <complex> (all of
which are identical) aren't comparable to C99's <complex.h>, so if
this was C++98 code using the C99 header, the code will be broken with
or without this transformation.)

> +                          {"iso646.h", "ciso646"},

Just delete #includes of this one. <ciso646> does nothing.

> +              {"stdalign.h", "cstdalign"},
> +              {"stdbool.h", "cstdbool"},

We should just delete these two includes. These headers do nothing in C++.

comments.end]

Reviewers: alexfh, aaron.ballman

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

llvm-svn: 278254
2016-08-10 18:01:45 +00:00
Kirill Bobyrev 607f50cdb3 [clang-rename] fix test introduced in r278221
llvm-svn: 278225
2016-08-10 13:46:36 +00:00
Kirill Bobyrev 3168418a7c [clang-rename] remove bunch of deprecated tests
llvm-svn: 278223
2016-08-10 13:32:37 +00:00
Kirill Bobyrev 77f522cb42 [clang-rename] merge tests when possible
The only difference between some tests is -offset passed to clang-rename. It
makes sense to merge them into a single file and add multiple tool invocations.

Reviewers: alexfh

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

llvm-svn: 278221
2016-08-10 13:28:30 +00:00
Miklos Vajna c29c81a03f clang-rename YAML reader: address post-commit comments
llvm-svn: 278201
2016-08-10 07:13:29 +00:00
Eugene Zelenko b614148024 [Documentation] Fix spelling mistakes in docs/clang-tidy/index.rst.
llvm-svn: 278198
2016-08-10 01:55:51 +00:00
Miklos Vajna 3d71b51bc5 clang-rename rename-all: support reading old/newname pairs from a YAML file
This is handy in case by the time clang-rename is invoked, an external
tool already genereated a list of oldname -> newname pairs to handle.

Reviewers: omtcyfz

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

llvm-svn: 278145
2016-08-09 18:20:41 +00:00
Kirill Bobyrev 7fa3395364 [clang-rename] cleanup: use isWritten
nit: use isWritten and const auto *Initializer in
NamedDeclFindingASTVisitor::VisitCXXConstructorDecl method.
Test plan: make -j8 check-clang-tools (passed)

Patch by Alexander Shaposhnikov!

Reviewers: omtcyfz

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

llvm-svn: 278112
2016-08-09 10:03:33 +00:00
Simon Pilgrim 6cfad71fd7 Fix Wdocumentation unknown parameter warning
llvm-svn: 278111
2016-08-09 10:02:11 +00:00
Haojian Wu c99f72868d [include-fixer] Support processing multiple files in one run.
Summary:
Previously, if we pass multiple files or a file pattern (e.g. /path/to/*.cc) to
include-fixer, include-fixer will apply all replacements to the first argument,
which probably causes crashes.

With this patch, include-fixer can process multiple files now.

Vim and Emacs integration are tested manually.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 278102
2016-08-09 08:26:19 +00:00
Eric Liu 7e5445267f Fix clang-tidy crash when a single fix is applied on multiple files.
Summary:
tooling::Replacements only holds replacements for a single file, so
this patch makes Fix a map from file paths to tooling::Replacements so that it
can be applied on multiple files.

Reviewers: hokein, alexfh

Subscribers: Prazek, cfe-commits

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

llvm-svn: 278101
2016-08-09 07:54:49 +00:00
Kirill Bobyrev 31fd7fb5e6 [clang-rename] fix bug with initializer lists
Clang-rename is currently not able to find a symbol in initializer list. This
patch fixes described issue.

Reviewers: alexfh

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

llvm-svn: 278099
2016-08-09 07:14:48 +00:00
Kirill Bobyrev 75de8968b6 [clang-tidy] enhance modernize-use-bool-literals to check ternary operator
modernize-use-bool-literals doesn't checks operands in ternary operator.

For example:

``` c++
static int Value = 1;

bool foo() {
  bool Result = Value == 1 ? 1 : 0;
  return Result;
}

bool boo() {
  return Value == 1 ? 1 : 0;
}
```

This issue was reported in bug 28854. The patch fixes it.

Reviewers: alexfh, aaron.ballman, Prazek

Subscribers: Prazek, Eugene.Zelenko

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

llvm-svn: 278022
2016-08-08 17:11:56 +00:00
Haojian Wu dd14b18def [include-fixer] Correct some header mappings.
Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 277811
2016-08-05 11:54:34 +00:00
John Brawn 4d79ec7fe8 Reapply r276973 "Adjust Registry interface to not require plugins to export a registry"
This differs from the previous version by being more careful about template
instantiation/specialization in order to prevent errors when building with
clang -Werror. Specifically:
 * begin is not defined in the template and is instead instantiated when Head
   is. I think the warning when we don't do that is wrong (PR28815) but for now
   at least do it this way to avoid the warning.
 * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY
   instead provide a template definition then do explicit instantiation. No
   compiler I've tried has problems with doing it the other way, but strictly
   speaking it's not permitted by the C++ standard so better safe than sorry.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

llvm-svn: 277806
2016-08-05 11:01:08 +00:00
Alexander Kornienko 6b2a4d5e8f [clang-tidy] misc-argument-comment non-strict mode
Summary:
The misc-argument-comment check now ignores leading and trailing underscores and
case. The new `StrictMode` local/global option can be used to switch back to
strict checking.

Add getLocalOrGlobal version for integral types, minor cleanups.

Reviewers: hokein, aaron.ballman

Subscribers: aaron.ballman, Prazek, cfe-commits

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

llvm-svn: 277729
2016-08-04 14:54:54 +00:00
Kirill Bobyrev 8100940b8b [clang-rename] add missing clang-format improvements
r277702 introduced clang-format changes so that later commits wouldn't introduce
non-functional changes while running clang-format before commiting. Though,
few changes by clang-format weren't in the patch.

llvm-svn: 277709
2016-08-04 09:23:30 +00:00
Miklos Vajna 0c07f0cb0b Run clang-format on clang-rename code
So that later commits don't introduce non-functional changes when
running clang-format before committing.

Reviewers: klimek

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

llvm-svn: 277702
2016-08-04 07:43:29 +00:00
Alexander Kornienko dcbf57d198 [clang-tidy] Inefficient string operation
Patch by Bittner Barni!

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

llvm-svn: 277677
2016-08-03 23:06:03 +00:00
Kirill Bobyrev d6ab7d4508 [clang-rename] improve USRFindingAction
1. Improve templated class renaming, namely add capabilities of finding partial
and full specializations. Every class partial specialization has reference to
the specialized class. Thus, storing all partial specializations and
comparing specialized class decls to the FoundDecl solves this. All full class
specializations can be found by calling ClassTemplateDecl::specializations().

2. Fix virtual function and its overriding functions renaming. Renaming a
virtual function requires renaming every other function in its "overriding
graph".

3. Merge TemplateClassInstantiationFindBy{Declaration|TypeUse}.cpp tests into
one test by adding multiple invocations of clang-rename to one test, because
the only different thing across these tests is -offset passed to clang-rename.

Reviewers: alexfh

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

llvm-svn: 277663
2016-08-03 23:00:32 +00:00
Kirill Bobyrev f9e2f4410e [docs] fix typo in clang-rename docs
clang-rename is a refactoring tool, not "linter" tool. Fix typo in docs.

llvm-svn: 277623
2016-08-03 18:15:07 +00:00
Etienne Bergeron 58728c6e9a [extra-tools] Fix extra tools build bot warnings due to incorrect doc
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/tools/clang/tools/extra/clang-tidy/mpi/TypeMismatchCheck.cpp:172:12: warning: parameter 'Complex' not found in the function declaration [-Wdocumentation]
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/tools/clang/tools/extra/clang-tidy/mpi/TypeMismatchCheck.cpp:206:12: warning: parameter 'Complex' not fo

llvm-svn: 277578
2016-08-03 06:59:46 +00:00
Kirill Bobyrev cf162a3031 [clang-tidy] address concerns with rL277340
alexfh raised a concern with https://reviews.llvm.org/rL277340

After retabbing indentation of .. code-block:: was increased to 8, 4 spaces
indentation should be enough.

Reviewers: alexfh
llvm-svn: 277577
2016-08-03 06:54:24 +00:00
Etienne Bergeron ee0627fd1b [clang-tidy] Fix missing dependency to static analyzer
Summary:
This patch is fixing the build bot broken for a missing dependency.

The missing dependency is breaking "shared" build.

```
./mpi/TypeMismatchCheck.cpp:
  #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
```

I'm not a fan of that fix. It's brining a strange dependency.

Reviewers: alexfh

Subscribers: llvm-commits, chrisha

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

llvm-svn: 277539
2016-08-02 22:51:46 +00:00
Jonathan Coe 77ec263e60 [clang-tidy] Fix segfault in cppcore-guidelines-special-member-functions check
Summary:
Use a set rather than a vector of defined special member functions so
that multiple declarations of the same function are only counted once.

Move some private static member functions into the cpp file.

Run clang-format on header.

Reviewers: ericLemanissier, Prazek, aaron.ballman

Subscribers: Prazek, cfe-commits, nemanjai

Projects: #clang-tools-extra

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

llvm-svn: 277523
2016-08-02 21:18:37 +00:00
Alexander Kornienko 053826f146 [docs] Fix links format.
llvm-svn: 277517
2016-08-02 20:29:47 +00:00
Alexander Kornienko 5e0a50c2d7 [clang-tidy] MPITypeMismatchCheck
This check verifies if buffer type and MPI (Message Passing Interface)
datatype pairs match. All MPI datatypes defined by the MPI standard (3.1)
are verified by this check. User defined typedefs, custom MPI datatypes and
null pointer constants are skipped, in the course of verification.

Instructions on how to apply the check can be found at:
https://github.com/0ax1/MPI-Checker/tree/master/examples

Patch by Alexander Droste!

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

llvm-svn: 277516
2016-08-02 20:29:35 +00:00
Kirill Bobyrev ef2ee1fd67 [clang-rename] fix Emacs integration script
llvm-svn: 277491
2016-08-02 18:23:08 +00:00
Kirill Bobyrev cb2bac6e98 [clang-rename] fix Emacs script build failure
Clang-rename Emacs integration script sometimes doesn't work correctly.

llvm-svn: 277469
2016-08-02 15:10:17 +00:00
NAKAMURA Takumi b650462007 clang-tools-extra/test/clang-rename/TemplateTypenameFindBy*.cpp: Appease targeting ms mode.
llvm-svn: 277452
2016-08-02 13:17:40 +00:00
NAKAMURA Takumi acf37a9234 clang-tools-extra/test/clang-rename/TemplateTypenameFindBy*.cpp: Move RUN: lines below not to be affected by tweaks of parameters.
llvm-svn: 277451
2016-08-02 13:17:36 +00:00
Haojian Wu da2a58dd0b [clang-tidy] Fix an unused-using-decl false positive about template arguments in
function call expression.

Summary:
The check doesn't mark the template argument as used when the template
argument is a template.

Reviewers: djasper, alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 277444
2016-08-02 11:26:35 +00:00
Haojian Wu adedac68dc [include-fixer] Correct nested class search for identifiers with scoped information
Summary:
include-fixer will firstly try to use scoped namespace context information to
search identifier. However, in some cases, it's unsafe to do nested class
search, because it might treat the identifier as a nested class of scoped
namespace.

Given the following code, and the symbol database only has two classes: "foo" and
"b::Bar".

    namespace foo { Bar t; }

Before getting fixing, include-fixer will never search "Bar" symbol.
Because it firstly tries to search "foo::Bar", there is no "Bar" in foo namespace,
then it finds "foo" in database finally. So it treats "Bar" is a nested class
of "foo".

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 277442
2016-08-02 10:43:10 +00:00
Miklos Vajna aaec9b6cfc clang-rename: split existing options into two new subcommands
- rename-at is meant to be integrated with editors and works mainly off
  of a location in a file, and this is the default
- rename-all is optimized for one or more oldname->newname renames, and
  works with clang-apply-replacements

Reviewers: bkramer, klimek

Subscribers: omtcyfz

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

llvm-svn: 277438
2016-08-02 09:51:31 +00:00
Kirill Bobyrev 9e0dab9352 [clang-rename] add support for template parameter renaming
Few simple tweaks allow template parameters to be renamed. See
TemplateTypenameFindBy{TemplateParam|TypeInside}.cpp

Reviewers: alexfh

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

llvm-svn: 277437
2016-08-02 09:38:38 +00:00
Kirill Bobyrev aa4845004d [clang-rename] add basic Emacs integration
This patch aims to add very basic Emacs integration.

Reviewers: hokein, alexfh

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

llvm-svn: 277433
2016-08-02 08:51:26 +00:00
Kirill Bobyrev 91053e0675 [clang-rename] handle overridden functions correctly
1. Renaming overridden functions only works for two levels of "overriding
   hierarchy". clang-rename should recursively add overridden methods.
2. Make use of forEachOverridden AST Matcher.
3. Fix two tests.

Reviewers: alexfh

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

llvm-svn: 277356
2016-08-01 17:15:57 +00:00
Kirill Bobyrev 08c47b37d3 [clang-rename] revert r276836
Revert r276836, which resulted in tests passing regardless of the actual tool
replacements.

llvm-svn: 277354
2016-08-01 16:48:33 +00:00
Kirill Bobyrev 11cea45cce [clang-tidy] remove trailing whitespaces and retab
llvm-svn: 277340
2016-08-01 12:06:18 +00:00
Martin Bohme d10be62383 [clang-tidy] Prepare modernize-loop-convert for upcoming changes in D22566
Summary:
D22566 will change RecursiveASTVisitor so that it descends into the initialization expressions for lambda captures.

modernize-loop-convert needs to be prepared for this so that it does not interpret these initialization expressions as invalid uses of the loop variable. The change has no ill effects without D22566 in place, i.e. the change does not depend on D22566.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 277339
2016-08-01 11:29:17 +00:00