summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-rename/RenamingAction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-rename] Enforce LLVM policy about braces around single line control ↵Kirill Bobyrev2016-09-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | flow statement body. Although it is not explicitly stated in LLVM Coding Standards, LLVM developers prefer to omit braces around flow control statements with single line body. For example the following piece of code ``` if (condition) std::cout << "Hello, world!" << std::endl; ``` is preferred to ``` if (condition) { std::cout << "Hello, world!" << std::endl; } ``` So far clang-rename has ignored this. This patch makes clang-rename more "LLVM-ish". llvm-svn: 280640
* [clang-rename] cleanup `auto` usagesKirill Bobyrev2016-08-151-4/+4
| | | | | | | | | | | | | | | | | | | 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
* clang-rename: split existing options into two new subcommandsMiklos Vajna2016-08-021-6/+15
| | | | | | | | | | | | | | | - 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
* Changes related to new implementation of tooling::Replacements as class.Eric Liu2016-08-011-9/+15
| | | | | | | | | | | | Summary: See http://reviews.llvm.org/D21748 for details. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21749 llvm-svn: 277336
* [clang-rename] speedup RenamingActionKirill Bobyrev2016-07-291-15/+9
| | | | | | | | | | | | 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
* [clang-rename] introduce better symbol findingKirill Bobyrev2016-07-221-8/+5
| | | | | | | | | | | | | | | 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
* [clang-rename] exit code-related bugfix and code cleanupBenjamin Kramer2016-07-141-1/+2
| | | | | | | | | | | | | | 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
* clang-rename: check that the source location we find actually has the old nameMiklos Vajna2016-05-131-1/+1
| | | | | | | | | | | 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
* Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.Eugene Zelenko2016-03-171-5/+2
| | | | | | Differential revision: http://reviews.llvm.org/D18231 llvm-svn: 263726
* Revert r241330. It compiled with Visual C++ 2013 and gcc 4.9.1 (mingw) but ↵Yaron Keren2015-07-031-5/+8
| | | | | | now fails the bots. llvm-svn: 241335
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-031-8/+5
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241330
* [cleanup] Re-sort the #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-2/+2
| | | | | | | No functionality changed, this is just a mechanical cleanup to keep the order of #include lines consistent across the project. llvm-svn: 225976
* Revert rL215947: "[clang-rename] revert r215839"Manuel Klimek2014-08-201-0/+90
| | | | | | Make tests not depend on grep supporting -bo. llvm-svn: 216041
* [clang-rename] revert r215839Gerolf Hoflehner2014-08-181-90/+0
| | | | | | | | | | | | | | | | | | | | The commit broke public build bots for more than 24 hours. (view as text) ******************** TEST 'Clang Tools :: clang-rename/VarTest.cpp' FAILED ******************** Script: -- cat /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp clang-rename -offset=$(grep -FUbo 'foo;' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | head -1 | cut -d: -f1) -new-name=hector /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp -i -- sed 's,//.*,,' /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp | FileCheck /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/tools/extra/test/clang-rename/VarTest.cpp -- Exit Code: 1 Command Output (stderr): -- clang-rename: could not find symbol at /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/tools/clang/tools/extra/test/clang-rename/Output/VarTest.cpp.tmp.cpp:2:1 (offset 14). llvm-svn: 215947
* First version of a clang-rename tool.Manuel Klimek2014-08-171-0/+90
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
OpenPOWER on IntegriCloud