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
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
- 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
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
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
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
The complexity of renaming a USR is O(N) [N stands for number of nodes in
Translation Unit]. In some cases there are more than one USR for a single symbol
(see overridden functions and ctor/dtor handling), which means that the
complexity of finding all of the corresponding USRs is O(N * M) [M stands for
number of USRs corresponding to the symbols, which may be not quite small]. With
a simple tweak we can make it O(N * log(M)) by passing whole list of USRs
corresponding to the symbol to USRLocFinder.
llvm-svn: 277131
This version has two fixes compared to the original:
* In Registry.h the template static members are instantiated before they are
used, as clang gives an error if you do it the other way around.
* The use of the Registry template in clang-tidy is updated in the same way as
has been done everywhere else.
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: 276973
Ensure that Context is always properly initialised in the constructor. It is
used for querying the LangOpts in VisitTypeLoc. Prevent a null pointer
dereference in setResult by ensuring that a RecordDecl is being handled.
Patch by Alexander Shaposhnikov!
llvm-svn: 276948
Change Vim key binding for include-fixer (`,cf` -> `<leader>cf`) and
clang-rename (`,cr` -> `<leader>cr`) to use `<leader>` instead of `,` like
cool Vim people (tm) do.
Reviewers: ioeric
Differential Revision: https://reviews.llvm.org/D22854
llvm-svn: 276870
Rather than copying the file and then doing an in-place edit, perform the
replacements to stdout and pass the output to FileCheck directly. Avoids
unnecessary copying and seds.
llvm-svn: 276836
Summary: In missing complete type cases, we don't know where to add the qualifiers.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D22812
llvm-svn: 276761
Summary:
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
Reviewers: alexfh
Subscribers: cfe-commits
Projects: #clang-tools-extra
Patch by Alexander Droste!
Differential Revision: https://reviews.llvm.org/D21962
llvm-svn: 276640
TemplateFunctionFindBy{Declaration|Use}.cpp contained typos and therefore were
failing. clang-rename passes these tests after typos are fixed.
llvm-svn: 276620
This patch introduces:
* TypeLoc visiting, which helps a lot in renaming types
* NestedNameSpecifierLoc visiting (through getting them via ASTMatcher at the moment, though, because RecursiveASTVisitor<T>::VisitNestedNameSpecifierLoc isn't implemented), which helps to treat nested names correctly
* better code formatting and refactoring
* bunch of tests
Reviewers: alexfh
Differential revision: https://reviews.llvm.org/D22465
llvm-svn: 276414
Summary:
Previoly, the added test failed with the fillowing fixit:
char v[5];
- for(size_t i = 0; i < 5; ++i)
+ for(char value : v)
{
- unsigned char value = v[i];
if (value > 127)
i.e. the variable 'value' changes from unsigned char to signed char. And
thus the following 'if' does not work anymore.
With this commit, the fixit is changed to:
char v[5];
- for(size_t i = 0; i < 5; ++i)
+ for(unsigned char value : v)
{
- unsigned char value = v[i];
if (value > 127)
Reviewers: alexfh, klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D22069
llvm-svn: 276111