summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-rename
Commit message (Collapse)AuthorAgeFilesLines
* [refactor] Move clang-rename into the clang repositoryAlex Lorenz2017-06-3032-555/+0
| | | | | | | | | | | | The core engine of clang-rename will be used for local and global renames in the new refactoring engine, as mentioned in http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html. The clang-rename tool is still supported but might get deprecated in the future. Differential Revision: https://reviews.llvm.org/D34696 llvm-svn: 306840
* clang-rename: add new -force optionMiklos Vajna2017-06-021-0/+4
| | | | | | | | | | | | | | | | | Summary: The use-case is when renaming a widely used name, like a lower-level class in a codebase and clang-rename is simply invoked for each translation unit based on the compile database. In this case it's not interesting to show errors: not finding the symbol means there is simply nothing to do. Reviewers: klimek Reviewed By: klimek Differential Revision: https://reviews.llvm.org/D32403 llvm-svn: 304534
* [clang-rename] Add test case for r287758.Benjamin Kramer2016-11-231-0/+9
| | | | llvm-svn: 287759
* [clang-rename] Prune away AST nodes more correctly and effectively when ↵Benjamin Kramer2016-11-221-5/+6
| | | | | | | | | | | | | | | | | | looking for a point Due to the way the preprocessor works nodes can be half in a macro or a different file. This means checking the file name of the start location of a Decl is not a correct way of checking if the entire Decl is in that file. Remove that flawed assumption and replace it with a more effective check: If the point we're looking for is *inside* of the begin and end location of a Decl, look inside. This should make clang-rename more reliable (for example macro'd namespaces threw it off before, as seen in the test case) and maybe a little faster by pruning off more stuff that the RecursiveASTVisitor doesn't have to drill into. llvm-svn: 287649
* [clang-rename] Fix handling of unchanged filesAlexander Shaposhnikov2016-09-172-0/+11
| | | | | | | | | | | | | | | | | | | | | | | Fix the output of clang-rename for the files without modifications. Update the code in clang-reorder-fields/tool/ClangReorderFields.cpp to avoid inconsistency. Example: a.h: struct A {}; a.cpp: #include "a.h" int main() { return 0; } Before the changes the output looks like this: clang-rename -qualified-name=A -new-name=B a.cpp <<<<<INVALID SOURCE LOCATION>>>>> Test plan: make -j8 check-clang-tools Differential revision: https://reviews.llvm.org/D24634 llvm-svn: 281826
* [clang-rename] Merge rename-{at|all} & optimise.Kirill Bobyrev2016-09-1610-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Having both rename-at and rename-all both seems confusing and introduces unneeded difficulties. After merging rename-at and rename-all maintaining main function wrappers and custom help becomes redundant while CLI becomes less confusing. D24224 (which was the original patch causing buildbot failures) wasn't aware of bugs caused by passing both -offset and -qualified-name. After D24224 was landed it caused buildbot failures and therefor I just reverted it. Two things that make this patch different from D24224 are: * unittests/clang-rename was deleted, because it is unmaintained and doesn't do much. * Passing both `-offset` and `-qualified-name` isn't allowed anymore for the sake of preventing bugs. This patch is a trivial enhancement of accepted D24224 revision. Tested with `ninja check-all`. Differential Revision: https://reviews.llvm.org/D24567 llvm-svn: 281710
* reverting r281456Kirill Bobyrev2016-09-145-5/+5
| | | | llvm-svn: 281459
* [clang-rename] Merge rename-{at|all} & optimize.Kirill Bobyrev2016-09-145-5/+5
| | | | | | | | | | | | | | Having both rename-at and rename-all both seems confusing and introduces unneeded difficulties. Allowing to use both -qualified-name and -offset at once while performing efficient renamings seems like a feature, too. Maintaining main function wrappers and custom help becomes redundant while CLI becomes less confusing. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D24224 llvm-svn: 281456
* [clang-rename] add failing testKirill Bobyrev2016-09-041-0/+22
| | | | | | | For some reason clang-rename fails to rename method of templated class. Add XFAIL test reproducing the issue. llvm-svn: 280639
* clang-rename: improve error message when -old-name is used and could not ↵Miklos Vajna2016-08-301-0/+2
| | | | | | | | | | | | | | find symbol Old output was: clang-rename: could not find symbol at tools/clang/tools/extra/test/clang-rename/ClassFindByName.cpp:1:1 (offset 0). Reviewers: omtcyfz Differential Revision: https://reviews.llvm.org/D24002 llvm-svn: 280062
* [clang-rename] fix test introduced in r278221Kirill Bobyrev2016-08-101-7/+7
| | | | llvm-svn: 278225
* [clang-rename] remove bunch of deprecated testsKirill Bobyrev2016-08-1017-295/+0
| | | | llvm-svn: 278223
* [clang-rename] merge tests when possibleKirill Bobyrev2016-08-1021-160/+292
| | | | | | | | | | | The only difference between some tests is -offset passed to clang-rename. It makes sense to merge them into a single file and add multiple tool invocations. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D23158 llvm-svn: 278221
* clang-rename rename-all: support reading old/newname pairs from a YAML fileMiklos Vajna2016-08-093-0/+19
| | | | | | | | | | | This is handy in case by the time clang-rename is invoked, an external tool already genereated a list of oldname -> newname pairs to handle. Reviewers: omtcyfz Differential Revision: https://reviews.llvm.org/D23198 llvm-svn: 278145
* [clang-rename] fix bug with initializer listsKirill Bobyrev2016-08-091-8/+9
| | | | | | | | | | | 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
* [clang-rename] improve USRFindingActionKirill Bobyrev2016-08-033-56/+35
| | | | | | | | | | | | | | | | | | | | | | 1. Improve templated class renaming, namely add capabilities of finding partial and full specializations. Every class partial specialization has reference to the specialized class. Thus, storing all partial specializations and comparing specialized class decls to the FoundDecl solves this. All full class specializations can be found by calling ClassTemplateDecl::specializations(). 2. Fix virtual function and its overriding functions renaming. Renaming a virtual function requires renaming every other function in its "overriding graph". 3. Merge TemplateClassInstantiationFindBy{Declaration|TypeUse}.cpp tests into one test by adding multiple invocations of clang-rename to one test, because the only different thing across these tests is -offset passed to clang-rename. Reviewers: alexfh Differential Revision: https://reviews.llvm.org/D23058 llvm-svn: 277663
* clang-tools-extra/test/clang-rename/TemplateTypenameFindBy*.cpp: Appease ↵NAKAMURA Takumi2016-08-022-2/+2
| | | | | | targeting ms mode. llvm-svn: 277452
* clang-tools-extra/test/clang-rename/TemplateTypenameFindBy*.cpp: Move RUN: ↵NAKAMURA Takumi2016-08-022-8/+8
| | | | | | lines below not to be affected by tweaks of parameters. llvm-svn: 277451
* clang-rename: split existing options into two new subcommandsMiklos Vajna2016-08-025-3/+19
| | | | | | | | | | | | | | | - 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
* [clang-rename] add support for template parameter renamingKirill Bobyrev2016-08-022-10/+2
| | | | | | | | | | | 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
* [clang-rename] handle overridden functions correctlyKirill Bobyrev2016-08-013-2/+16
| | | | | | | | | | | | | 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
* [clang-rename] revert r276836Kirill Bobyrev2016-08-0127-43/+96
| | | | | | | Revert r276836, which resulted in tests passing regardless of the actual tool replacements. llvm-svn: 277354
* test: fix typo in file name (NFC)Saleem Abdulrasool2016-07-281-0/+0
| | | | llvm-svn: 276949
* clang-rename: adjust NamedDeclFindingASTVisitor for RecordDeclsSaleem Abdulrasool2016-07-281-0/+13
| | | | | | | | | | 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
* [clang-rename] skip CXXConversionDecl while searching for NamedDeclKirill Bobyrev2016-07-271-5/+3
| | | | llvm-svn: 276866
* test: simplify commands, NFCSaleem Abdulrasool2016-07-2727-96/+43
| | | | | | | | 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
* [Clang-rename] Remove custom version, fix extra space in error message.Eugene Zelenko2016-07-251-1/+1
| | | | | | | | Also fixed some Include What You Use Warnings. Differential revision: https://reviews.llvm.org/D22654 llvm-svn: 276684
* [clang-rename] fix typos in testsKirill Bobyrev2016-07-252-12/+6
| | | | | | | TemplateFunctionFindBy{Declaration|Use}.cpp contained typos and therefore were failing. clang-rename passes these tests after typos are fixed. llvm-svn: 276620
* [clang-rename] introduce better symbol findingKirill Bobyrev2016-07-2211-25/+230
| | | | | | | | | | | | | | | 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] check whether -new-name is valid identifier in C++17 Kirill Bobyrev2016-07-212-1/+3
| | | | llvm-svn: 276259
* [clang-rename] remove obsolete tests and apply fixes to existingKirill Bobyrev2016-07-1611-148/+20
| | | | | | | | Few tests introduced by previous patch had obsolete counterparts. Applied fixes to {Dynamic|Static}CastExpr.cpp llvm-svn: 275681
* [clang-rename] fix testsetKirill Bobyrev2016-07-1520-60/+254
| | | | | | Make yet unsupported tests marked with FIXME pass so that buildbot doesn't fail. llvm-svn: 275556
* [clang-rename] add few testsKirill Bobyrev2016-07-155-0/+76
| | | | | | | | Thiis patch introduces few additional tests including one case the tool does not handle yet, which should be fixed in the future. Differential Revision: https://reviews.llvm.org/D22102 llvm-svn: 275545
* [clang-rename] exit code-related bugfix and code cleanupBenjamin Kramer2016-07-141-0/+20
| | | | | | | | | | | | | | 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: try to make ClassTestReplacements more reliableMiklos Vajna2016-06-271-3/+4
| | | | | | | | | | | | | | | | | 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
* clang-rename: add a -export-fixes optionMiklos Vajna2016-06-271-0/+11
| | | | | | | | | | | | | | | | | | 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
* clang-rename: add a -old-name optionMiklos Vajna2016-06-211-0/+10
| | | | | | | | | | | | | | | | | | | | | 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
* clang-rename: implement renaming of classes with a dtorMiklos Vajna2016-06-151-0/+17
| | | | | | | | | | | 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
* clang-rename: implement handling of remaining named castsMiklos Vajna2016-06-132-0/+34
| | | | | | | | | | const_cast<> and reinterpret_cast<>. Reviewers: klimek Differential Revision: http://reviews.llvm.org/D21270 llvm-svn: 272574
* clang-rename: fix the DynamicCastExpr test on ps4Miklos Vajna2016-06-101-1/+1
| | | | | | | | | | It has RTTI disabled by default, so need to enable it explicitly. Reviewers: silvas Differential Revision: http://reviews.llvm.org/D21186 llvm-svn: 272381
* clang-rename: implement renaming of classes inside dynamic_castMiklos Vajna2016-06-081-0/+25
| | | | | | | | | | 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
* clang-rename: implement renaming of classes inside static_castMiklos Vajna2016-06-061-0/+24
| | | | | | | | | | | "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
* clang-rename: fix renaming heap allocationsMiklos Vajna2016-06-021-0/+14
| | | | | | | | | | 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
* clang-rename: fix renaming non-members variables when referenced as macro ↵Miklos Vajna2016-05-241-0/+24
| | | | | | | | | | | | arguments The second check failed, FOO(C::X) wasn't renamed to FOO(C::Y). Reviewers: klimek Differential Revision: http://reviews.llvm.org/D20537 llvm-svn: 270599
* clang-rename: fix renaming members when referenced as macro argumentsMiklos Vajna2016-05-201-0/+25
| | | | | | | | | | The second check failed, FOO(C.X) wasn't renamed to FOO(C.Y). Reviewers: klimek Differential Revision: http://reviews.llvm.org/D20446 llvm-svn: 270204
* clang-rename: handle non-inline ctor definitions when renaming classesMiklos Vajna2016-05-181-0/+15
| | | | | | | | | | The result of the test was C::D(), not D::D(). Reviewers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20356 llvm-svn: 269952
* clang-rename: fix renaming of field with implicit initializersMiklos Vajna2016-05-111-0/+20
| | | | | | | | | | 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
* clang-rename tests: move the run lines to the top of the test filesMiklos Vajna2016-05-093-9/+9
| | | | | | | | | | Summary: To be consistent with the other tests. Reviewers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D20059 llvm-svn: 268897
* clang-rename: when renaming a field, rename initializers of that field as wellMiklos Vajna2016-05-071-0/+17
| | | | | | | | | | Summary: The second check failed, the initializer wasn't renamed. Reviewers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19957 llvm-svn: 268857
* When renaming a class, ename pointers to that class as well.Manuel Klimek2016-05-041-0/+15
| | | | | | Patch by Miklos Vajna. llvm-svn: 268484
OpenPOWER on IntegriCloud