Currently, to be able to process a source file including e.g. stddef.h with
clang-tidy, one has to build both clang-tidy and the clang-headers target.
Since stddef.h is needed for virtually any source file, let clang-tidy depend
on clang-headers, so that it Just Works after it has been built.
http://reviews.llvm.org/D22046
llvm-svn: 274751
Summary: This patch is adding support to recognize more complex redundant expressions.
Reviewers: alexfh
Subscribers: aaron.ballman, cfe-commits, chrisha
Differential Revision: http://reviews.llvm.org/D21392
llvm-svn: 274731
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
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
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
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
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
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
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
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
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
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
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
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
It has RTTI disabled by default, so need to enable it explicitly.
Reviewers: silvas
Differential Revision: http://reviews.llvm.org/D21186
llvm-svn: 272381
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
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
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
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