As Alexander pointed out, LLVM Coding Standards are more conservative about
using auto, i.e. it should be used in the following situations:
* When the type is obvious, i.e. explicitly mentioned in the same expression.
For example `if (const clang::FieldDecl *FieldDecl = Initializer->getMember())`.
* When the type is totally non-obvious and one iterates over something. For
example
`for (const auto &CurrDecl : Context.getTranslationUnitDecl()->decls())`.
Otherwise the type should be explicitly stated.
Reviewers: alexfh
Differential Revision: https://reviews.llvm.org/D23397
llvm-svn: 278760
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
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
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
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 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
This patch does the following:
* enforces proper formatting for few files (i.e. deals with 80 linewidth violations and few other things)
* ensures '\n' chars are passed to the output streams instead of "\n" strings
* fixes a bug caused by calling cl::PrintHelpMessage(), which occasionally calls exit(0), so that exit(1) (which is right after cl::PrintHelpMessage line) becomes dead code
Patch by Kirill Bobyrev!
Differential Revision: http://reviews.llvm.org/D22091
llvm-svn: 275387
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
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
"Derived" in static_cast<Derived&>(...) wasn't renamed, nor in its
pointer equivalent.
Reviewers: klimek
Differential Revision: http://reviews.llvm.org/D21012
llvm-svn: 271933
The check failed, 'Cla *C = new Cla();' was renamed to 'D *C = new Cla();'.
Reviewers: klimek
Differential Revision: http://reviews.llvm.org/D20635
llvm-svn: 271572
Even if this is defined in the .cpp file and only used as part of the
function (so here it's safe), usually storing StringRefs in the class is
dangerous, so don't do so.
Reviewers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20296
llvm-svn: 269796
This more general check could have prevented the specific problem
"getSourceOrder() == -1" guards.
Reviewers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20216
llvm-svn: 269402
The last check failed as Cla::Cla() was rewritten to Cla::hector().
Reviewers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20150
llvm-svn: 269161
Summary:
Note that this code is still grossly under-tested - the next steps will
be to add significantly better test coverage.
Patch by Matthew Plant.
Test Plan:
Reviewers:
Subscribers:
llvm-svn: 215839