Commit Graph

1708 Commits

Author SHA1 Message Date
Eric Liu c97b9bda76 Fix broken build caused by r274494.
llvm-svn: 274495
2016-07-04 11:42:37 +00:00
Eric Liu f33bc95f8f [include-fixer] make HeaderMapCollector maps from regex instead of postfix.
Summary:
this enables us to map a group of headers to one header name,
e.g. headers from one directory can be mapped to the same header.

Reviewers: bkramer

Subscribers: cfe-commits, hokein

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

llvm-svn: 274494
2016-07-04 11:22:35 +00:00
Felix Berger 7f8827576c [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.
Summary:

Make check more useful in the following two cases:

The parameter is passed by non-const value, has a non-deleted move constructor and is only referenced once in the function as argument to the type's copy constructor.
The parameter is passed by non-const value, has a non-deleted move assignment operator and is only referenced once in the function as argument of the the type's copy assignment operator.
In this case suggest a fix to move the parameter which avoids the unnecessary copy and is closest to what the user might have intended.

Reviewers: alexfh, sbenza

Subscribers: cfe-commits, Prazek

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

llvm-svn: 274380
2016-07-01 20:12:15 +00:00
Samuel Benzaquen 25cd6139e3 [clang-tidy] Do not match on lambdas.
We match on the generated FunctionDecl of the lambda and try to fix it.
This causes a crash.
The right behavior is to ignore lambdas, because they are a definition.

llvm-svn: 274019
2016-06-28 14:19:41 +00:00
Piotr Padlewski b0869a7522 [clang-tidy] boost-use-to-string arg expr location bugfix
Summary: getExprLoc returns location after dot for member call.

Reviewers: alexfh, sbenza, hokein

Subscribers: cfe-commits

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

llvm-svn: 274001
2016-06-28 08:16:20 +00:00
NAKAMURA Takumi 79027efe76 clang-rename: Update libdeps corresponding to r273910.
llvm-svn: 273993
2016-06-28 06:08:10 +00:00
Miklos Vajna 44de0ad6a8 clang-rename: try to make ClassTestReplacements more reliable
As it failed on e.g.
<http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/7089/steps/ninja%20check%201/logs/FAIL%3A%20Clang%20Tools%3A%3AClassTestReplacements.cpp> with:

Trouble iterating over directory '/home/buildbots/ppc64be-clang-test/clang-ppc64be/stage1/tools/clang/tools/extra/test/clang-rename/Output': No such file or directory

A reliable way to trigger the problem locally is to run all clang-rename
tests in parallel in a loop:

for i in $(seq 1 100); do ~/git/llvm/workdir/bin/llvm-lit -v -j15 . || break; done

Change the test script to be more similar to test/Tooling/clang-check.cpp, that
way the above command doesn't fail for me anymore.

llvm-svn: 273941
2016-06-27 21:04:53 +00:00
Miklos Vajna a2ca3eda5d clang-rename: add a -export-fixes option
Use case: a class is declared in a header, and defined in two
translation units. clang-rename is asked to rename a class member that's
referenced in both translation units.

Using -i is not possible, as in case the first clang-rename invocation
touches the header, the second invocation will result in compilation
errors. Using -export-fixes handles this situation, each invocation can
work on the original source, and at the end the user can apply the
replacements with clang-apply-replacements.

Reviewers: klimek

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

llvm-svn: 273910
2016-06-27 19:34:47 +00:00
Haojian Wu eb646e0d9b [clang-tidy] Warning enum unused using declarations.
Reviewers: alexfh, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 273882
2016-06-27 14:47:39 +00:00
Haojian Wu e5d277923a [clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.
Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 273849
2016-06-27 08:04:01 +00:00
NAKAMURA Takumi 819f3b95ae clang-tools-extra/test/clang-tidy/modernize-use-using.cpp: Satisfy thiscall.
llvm-svn: 273834
2016-06-26 23:56:07 +00:00
Krystyna Gajczyk c37933a12a [clang-tidy] Add modernize-use-using
http://reviews.llvm.org/D18919

llvm-svn: 273786
2016-06-25 18:37:53 +00:00
Cong Liu 998fb5c28b Remove ignoringImplicit from clang-tidy.
llvm-svn: 273660
2016-06-24 09:39:28 +00:00
Miklos Vajna b70539c317 Fix build of ClangRenameTests
Adapt the test to the code change introduced in r273304.

llvm-svn: 273314
2016-06-21 20:30:40 +00:00
Tim Shen 325c727480 Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.
Summary: This is a fix for the new ExprWithCleanups introduced by clang's temporary variable lifetime marks change.

Reviewers: bkramer, sbenza, angelgarcia, alexth

Subscribers: rsmith, cfe-commits

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

llvm-svn: 273310
2016-06-21 20:11:20 +00:00
Miklos Vajna 47bd46395a clang-rename: add a -old-name option
This is similar to -offset with the following differences:

1) -offset can refer to local variables as well.

2) -old-name makes it easier to refer to e.g. ClassName::MemberName by
spelling out the fully qualified name, instead of having to use e.g.
grep to look up the exact offset.

In other words, -offset is great when clang-rename is invoked by e.g. an
IDE, but not really user-friendly when the tool is invoked by the user
from commandline.  That's the use case where -old-name is supposed to
improve the situation.

Reviewers: klimek

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

llvm-svn: 273304
2016-06-21 19:48:57 +00:00
Eric Liu de027f2791 [clang-apply-replacements] use Range::operator==() instead of self-defined operator.
llvm-svn: 273291
2016-06-21 17:59:57 +00:00
Piotr Padlewski 552d449482 [clang-tidy] Add modernize-use-emplace
Summary: Add check that replaces call of push_back to emplace_back

Reviewers: hokein

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

llvm-svn: 273275
2016-06-21 15:23:27 +00:00
Alexander Kornienko c732c61b6d [clang-tidy] More doc fixes. NFC.
llvm-svn: 272995
2016-06-17 12:01:15 +00:00
Alexander Kornienko c9c8290251 [clang-tidy] Fix doxygen errors. NFC.
llvm-svn: 272994
2016-06-17 11:43:33 +00:00
Alexander Kornienko 2150390a2a [clang-tidy] readability-identifier-naming - Support for Macros
Summary:
Added support for macro definitions.
--

1. Added a pre-processor callback to catch macro definitions
2. Changed the type of the failure map so that macros and declarations can share the same map
3. Added extra tests to ensure fix-ups work using the new map
4. Added fix-ups for type aliases in variable and function declarations as part of adding the new tests

Reviewers: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

Patch by James Reynolds!

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

llvm-svn: 272993
2016-06-17 09:25:24 +00:00
Alexander Kornienko b0f613bfc8 [clang-tidy] misc-move-const-arg: Fix typos
Reviewers: alexfh

Subscribers: cfe-commits

Patch by Martin Boehme!

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

llvm-svn: 272897
2016-06-16 14:32:54 +00:00
Alexander Kornienko 28b34b043e [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument
Summary:
Conceptually, this is very close to the existing functionality of misc-move-const-arg, which is why I'm adding it here and not creating a new check. For example, for a type A that is both movable and copyable, this

  const A a1;
  A a2(std::move(a1));

is not only a case where a const argument is being passed to std::move(), but the result of std::move() is also being passed as a const reference (due to overload resolution).

The new check typically triggers (exclusively) in cases where people think they're dealing with a movable type, but in fact the type is not movable.

Reviewers: hokein, aaron.ballman, alexfh

Subscribers: aaron.ballman, cfe-commits

Patch by Martin Boehme!

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

llvm-svn: 272896
2016-06-16 14:32:41 +00:00
Artem Belevich 0ccbe69d18 [clang-tools] mark TokenName as unused
Otherwise it produces compiler warning if asserts are disabled.

llvm-svn: 272852
2016-06-15 23:04:42 +00:00
Miklos Vajna 7712bf3f53 clang-rename: implement renaming of classes with a dtor
The declaration wasn't renamed. Also neither part of the declaration
wasn't renamed.

Reviewers: klimek

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

llvm-svn: 272816
2016-06-15 18:35:41 +00:00
Benjamin Kramer 6f90dcc609 [clang-tidy] Remove dead code. NFC.
llvm-svn: 272803
2016-06-15 16:51:04 +00:00
Benjamin Kramer 51a9cc9ce7 Apply performance-unnecessary-value-param to clang-tidy.
With minor manual tweaks. No functionality change intended.

llvm-svn: 272795
2016-06-15 15:46:10 +00:00
Haojian Wu d58dc298ef [include-fixer] Correct two wrong header mappings.
Reviewers: bkramer

Subscribers: ioeric, cfe-commits

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

llvm-svn: 272773
2016-06-15 11:15:12 +00:00
Eric Liu f9c111bd07 [include-fixer] remove redundant code.
llvm-svn: 272657
2016-06-14 12:14:36 +00:00
Eric Liu a4be83a302 [include-fixer] only deduplicate symbols after matching symbols with the undefined identifier.
Summary:
we should only deduplicate symbols after matching symbols with the
undefined identifier. This patch tries to fix the situation where matching
symbols are deleted when it has the same header as a non-matching symbol, which
can prevent finding the correct header even if there is a matched symbol.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 272576
2016-06-13 19:05:07 +00:00
Miklos Vajna 6ff8f25a51 clang-rename: implement handling of remaining named casts
const_cast<> and reinterpret_cast<>.

Reviewers: klimek

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

llvm-svn: 272574
2016-06-13 18:50:45 +00:00
Eric Liu f4a5710a80 [include-fixer] give users an option to show N more headers in case there are too many candidates.
Summary: give users an option to show N more headers in case there are too many candidates.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 272387
2016-06-10 12:09:33 +00:00
Miklos Vajna e9c756512b clang-rename: fix the DynamicCastExpr test on ps4
It has RTTI disabled by default, so need to enable it explicitly.

Reviewers: silvas

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

llvm-svn: 272381
2016-06-10 08:29:02 +00:00
Eric Liu 1899d54ed0 [include-fixer] do not index friend function declaration.
Summary:
we want to exclude friend declaration, but the `DeclContext` of a
friend function declaration is not the class in which it is declared, so we need
to explicitly check if the parent is a `friendDecl`.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 272261
2016-06-09 14:18:40 +00:00
Richard Smith 22252f9847 Update to match LLVM r272232.
llvm-svn: 272235
2016-06-09 00:54:42 +00:00
Miklos Vajna 85b7b1c06a clang-rename: implement renaming of classes inside dynamic_cast
Refactor to do the same as what is done already for static_cast.

Reviewers: klimek

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

llvm-svn: 272188
2016-06-08 18:38:23 +00:00
Alexander Kornienko 3971dbac57 [clang-tidy] misc-argument-comment: don't bail out when an argument is a macro expansion (e.g. NULL).
Add CHECK-FIX tests.

llvm-svn: 272155
2016-06-08 15:27:46 +00:00
Haojian Wu 13d3048ced [include-fixer] Keep dot dot in SymbolInfo file paths.
Summary:
Currently, removing dot dot in header's path doesn't make include-fixer
minimize path correctly in some cases, for example, specify a relative search
path based on the build directory("-I../include/").

Besides, removing dot dot can break symbolic link directories. So don't
removing it for now.

Reviewers: ioeric, bkramer

Subscribers: cfe-commits

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

llvm-svn: 272152
2016-06-08 15:10:18 +00:00
Eric Liu 81689dab6c [include-fixer] explicitly set minimize-paths in test.
llvm-svn: 272151
2016-06-08 14:57:43 +00:00
Alexander Kornienko fb90b51e63 [clang-tidy] correct clang-tidy-diff.py help message
Summary:
Looks like the original code was copied from clang-format-diff.py.
Update help message to make it clang-tidy specific.

Reviewers: klimek, alexfh

Subscribers: Eugene.Zelenko, cfe-commits

Patch by Igor Sugak!

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

llvm-svn: 272144
2016-06-08 14:27:43 +00:00
Eric Liu 072ccfc997 [include-fixer] do not add enum forward declaration into symbol index table.
llvm-svn: 272132
2016-06-08 12:13:14 +00:00
Daniel Marjamaki 8ba0233e46 [clang-tidy] misc-macro-parentheses - avoid adding parentheses in variable declarations
Fixes bugzilla issues 26273 and 27399

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 272128
2016-06-08 10:30:24 +00:00
Eugene Zelenko 930e031d64 [Clang-tidy] Alphabetical checks order in release notes.
Highlight return statement in misc-unconventional-assign-operator documentation.

llvm-svn: 272042
2016-06-07 18:38:42 +00:00
Eugene Zelenko 04c14db108 [Clang-tidy] Documentation style consistency.
llvm-svn: 272038
2016-06-07 18:29:15 +00:00
Aaron Ballman 4c4bdba28a Fixing a build bot issue with duplicate explicit instantiations.
llvm-svn: 272027
2016-06-07 17:32:07 +00:00
Aaron Ballman d96ce2a94c Adding a release note for the misc-misplaced-const check added in r272025.
llvm-svn: 272026
2016-06-07 17:29:49 +00:00
Aaron Ballman cf6cefd88a Add the misc-misplaced-const check to clang-tidy, which diagnoses when a const-qualifier is applied to a typedef of pointer type rather than to the pointee type.
llvm-svn: 272025
2016-06-07 17:22:47 +00:00
Eric Liu f832eb7e9f [include-fixer] try to make vim header selection more friendly.
Summary: use 'input()' to get user's input so that we can support more options.

Reviewers: hokein, bkramer

Subscribers: cfe-commits

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

llvm-svn: 272004
2016-06-07 12:21:43 +00:00
Alexander Kornienko 5ae76e09ad [clang-tidy] readability-identifier-naming - Support for Type Aliases
Summary: Added support for Type Alias declarations.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by James Reynolds!

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

llvm-svn: 271992
2016-06-07 09:11:19 +00:00
Haojian Wu ba992cf3de [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.
Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 271991
2016-06-07 08:55:38 +00:00