Commit Graph

6 Commits

Author SHA1 Message Date
Kirill Bobyrev 83d5d5680f [clang-rename] speedup RenamingAction
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
2016-07-29 10:16:45 +00:00
Benjamin Kramer 1afefc0da3 [clang-rename] exit code-related bugfix and code cleanup
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
2016-07-14 09:46:03 +00:00
Miklos Vajna 1d48e50159 clang-rename: check that the source location we find actually has the old name
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
2016-05-13 09:17:32 +00:00
Manuel Klimek de23726dbd Revert rL215947: "[clang-rename] revert r215839"
Make tests not depend on grep supporting -bo.

llvm-svn: 216041
2014-08-20 01:39:05 +00:00
Gerolf Hoflehner 62bf7e83cb [clang-rename] revert r215839
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
2014-08-18 23:03:30 +00:00
Manuel Klimek ccf0d79724 First version of a clang-rename tool.
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
2014-08-17 18:00:59 +00:00