summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-move
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-041-2/+5
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* Fix clang-move test.Alexander Kornienko2019-03-221-1/+1
| | | | llvm-svn: 356795
* Fix file headers. NFCFangrui Song2019-03-011-1/+1
| | | | llvm-svn: 355188
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Add explicit dependency on clangSerialization after rC348911Fangrui Song2018-12-121-0/+1
| | | | llvm-svn: 348916
* [clang-move] Dump whether a declaration is templated.Eric Liu2018-10-081-20/+26
| | | | llvm-svn: 343982
* [clang-move] ClangMoveTests: Remove dots in output pathsSimon Marchi2018-07-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Following D48903 ([VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name), the paths output by clang-move in the FileToReplacements map may contain leading "./". For example, where we would get "foo.h", we'll now get "./foo.h". This breaks the tests, because we are doing exact string lookups in the FileToFileID and Results maps (they contain "foo.h", but we search for "./foo.h"). To mitigate this, try to normalize a little bit the paths output by clang-move to remove that leading "./". This patch should be safe to merge before D48903, remove_dots will just be a no-op. Reviewers: ilya-biryukov, hokein Reviewed By: hokein Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D48951 llvm-svn: 336358
* Trying to fix clang-move tests on windows build bot broken by r332717Eric Liu2018-05-181-17/+18
| | | | | | http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10702 llvm-svn: 332732
* [clang-move] Fix the incorrect expansion end location.Haojian Wu2018-02-121-3/+7
| | | | | | | | | | | | | | | | | | | | Summary: Before the fix, if clang-move decides to move the following macro statement, it only moves the first line `DEFINE(A,`. ``` DEFINE(A, B); ``` Reviewers: ioeric Reviewed By: ioeric Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43174 llvm-svn: 324886
* [clang-move] Don't dump macro symbols.Haojian Wu2018-02-091-1/+23
| | | | | | | | | | Reviewers: ioeric Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43075 llvm-svn: 324742
* [clang-move] Clever on handling header file which includes itself.Haojian Wu2018-01-311-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we assume only old.cc includes "old.h", which would introduce incorrect fixes for the cases where old.h also includes `#include "old.h"` Although it should not be occurred in real projects, clang-move should handle this. Old.h: ``` class Foo {}; ``` after moving to a new old.h: ``` class Foo {}; ``` Reviewers: ioeric Reviewed By: ioeric Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D42639 llvm-svn: 323865
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* [clang-move] Find template class forward declarations more precisely.Haojian Wu2017-05-021-5/+16
| | | | | | | | | | | | Reviewers: ioeric Reviewed By: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32741 llvm-svn: 301914
* [clang-move] Extend clang-move to support moving global variable.Haojian Wu2017-02-271-1/+4
| | | | | | | | | | | | | | Summary: Also support dumping global variables. Reviewers: ioeric Reviewed By: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30337 llvm-svn: 296337
* Fix clang-move test after clang-format update r295312Krasimir Georgiev2017-02-161-3/+3
| | | | llvm-svn: 295317
* [clang-move] Dump enum and type alias declarations.Haojian Wu2017-01-161-13/+11
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28293 llvm-svn: 292098
* Remove unused lambda captures. NFCMalcolm Parsons2017-01-131-2/+2
| | | | llvm-svn: 291941
* [clang-move] Support moving type alias declarations.Haojian Wu2017-01-041-19/+0
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28279 llvm-svn: 290967
* [clang-move] Support moving enum declarations.Haojian Wu2017-01-031-1/+0
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28228 llvm-svn: 290891
* [clang-move] Only move used helper declarations.Haojian Wu2017-01-031-2/+19
| | | | | | | | | | | | | | | | | Summary: Instead of moving all the helper declarations blindly, this patch implements an AST-based call graph solution to make clang-move only move used helper decls to new.cc and remove unused decls in old.cc. Depends on D27674. Reviewers: ioeric Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D27673 llvm-svn: 290873
* [clang-move] Fix incorrect EndLoc for declarations in macros.Haojian Wu2016-12-131-0/+18
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27713 llvm-svn: 289541
* [clang-move] ignore unsupported symbol kinds when checking if all symbols ↵Eric Liu2016-12-061-3/+20
| | | | | | are moved. llvm-svn: 288791
* ClangMoveTests.cpp: Fix a bogus comparison of iterator.NAKAMURA Takumi2016-11-281-1/+2
| | | | | | msc Debug build detected it. llvm-svn: 288034
* [clang-move] Enable dump all declarations in old header.Haojian Wu2016-11-241-14/+77
| | | | | | | | | | | | | | | | | | | Summary: * Add -dump_dels option to dump all declarations from old header. It will allow clang-move used as a frontend to get declarations from header. Further more, this will make debugging stuff easier. Currently only class/function types are supported. * Refactoring code a little bit by creating a ClangMoveContext which holds all options for ClangMoveTool, which can simplify the code in some degree. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27059 llvm-svn: 287863
* [clang-move] Add some options allowing to add old/new.h to new/old.h ↵Haojian Wu2016-11-231-0/+48
| | | | | | | | | | | | | | | | respectively. Summary: * --new_depend_on_old: new header will include old header * --old_depend_on_new: old header will include new header. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26966 llvm-svn: 287752
* [clang-move] Make the output code look more pretty.Haojian Wu2016-11-151-6/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add decent blank lines between declarations: * Add extra blank line after #define or #includes. * Add extra blank line between declarations. * Add extra blank line in front of #endif. Previously, the new generated code is quite tight: ``` #ifndef FOO_H #define FOO_H namespace a { class A { public: int f(); }; int A::f() { return 0; } } // namespace a #endif // FOO_H ``` After this patch, the code looks like: ``` #ifndef FOO_H #define FOO_H namespace a { class A { public: int f(); }; int A::f() { return 0; } } // namespace a #endif // FOO_H ``` Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26493 llvm-svn: 286943
* [clang-move] Fix an incorrect range for the functions whose returned value ↵Haojian Wu2016-11-141-0/+18
| | | | | | | | | | | | | | | | | | | is a macro Summary: Fix an incorrect range for the functions whose returned value is a macro (e.g. `bool`). This incorrect range can lead to modifications of an unexpected file where the macro is in. We should use expansion location instead of spelling location. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26609 llvm-svn: 286833
* [clang-move] Move all code from old.h/cc directly when moving all class ↵Haojian Wu2016-11-081-6/+80
| | | | | | | | | | | | | | declarations from old.h. Summary: When moving all code to new.h/cc, these code also will be formatted based on the given code style. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26236 llvm-svn: 286281
* [clang-move] Support moving template class forward declarations.Haojian Wu2016-10-211-0/+3
| | | | llvm-svn: 284859
* ClangMoveTests.cpp: Appease msc18.NAKAMURA Takumi2016-10-171-4/+4
| | | | | | | | | | | | | | | clang-tools-extra\unittests\clang-move\ClangMoveTests.cpp(216) : error C2593: 'operator =' is ambiguous llvm\include\llvm/ADT/SmallVector.h(898): could be 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(std::initializer_list<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>)' llvm\include\llvm/ADT/SmallVector.h(893): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVectorImpl<T> &&)' with [ T=std::string ] llvm\include\llvm/ADT/SmallVector.h(883): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVector<std::string,4> &&)' llvm\include\llvm/ADT/SmallVector.h(873): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(const llvm::SmallVector<std::string,4> &)' while trying to match the argument list '(llvm::SmallVector<std::string,4>, initializer-list)' llvm-svn: 284360
* Reformat.NAKAMURA Takumi2016-10-171-4/+4
| | | | llvm-svn: 284359
* [clang-move] Use cl::list for the list of namesAlexander Shaposhnikov2016-10-141-4/+4
| | | | | | | | | | This diff replaces manual parsing of the comma-separated list of names with cl::list and cl::CommaSeparated. Test plan: make -j8 check-clang-tools Differential revision: https://reviews.llvm.org/D25586 llvm-svn: 284291
* [clang-move] Add header guard for the new header.Haojian Wu2016-10-141-2/+5
| | | | | | | | | | | | | | | | | | Summary: The header guard generated by clang-move isn't always a perfect style, just avoid getting the header included multiple times during compiling period. Also, we can use llvm-Header-guard clang-tidy check to correct the guard automatically. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25610 llvm-svn: 284233
* Recommit r283538 "[clang-move] Support moving multiple classes in one run."Haojian Wu2016-10-131-4/+4
| | | | llvm-svn: 284109
* Revert "[clang-move] Support moving multiple classes in one run."Renato Golin2016-10-071-4/+4
| | | | | | | | | | | This reverts commit r283526 et al as it keeps randomly breaking bots, even after the commit has gone, on other people's commit ranges. Revert "[clang-move] Simplify lint tests" (r283545). Revert "Fix buildbot error." (r283534). Revert "Revert "fix buildbot error" since it is not right fix." (r283538). llvm-svn: 283553
* [clang-move] Support moving multiple classes in one run.Haojian Wu2016-10-071-4/+4
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25309 llvm-svn: 283526
* [clang-move] Move comments which are associated with the moved class.Haojian Wu2016-10-061-9/+41
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25227 llvm-svn: 283425
* [clang-move] Cleanup around replacements.Haojian Wu2016-10-061-1/+1
| | | | | | | | | | | | | | Summary: cleanup the remaining empty namespace after moving out the class defintitions. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25282 llvm-svn: 283424
* [clang-move] Make it support both relative and absolute file path arguments.Haojian Wu2016-10-041-2/+5
| | | | | | | | | | Reviewers: ioeric Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24922 llvm-svn: 283202
* [clang-move] The new.cc file should include new_header.h instead of old_header.hHaojian Wu2016-09-231-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, all #includes (includeing old_header.h) in old.cc will be copied to new.cc, however, the new.cc should include new_header.h instead of the old_header.h Before applying the patch, the new.cc looks like: ``` #include "old_header.h" ... ``` The new.cc looks like with this patch: ``` #include "new_header" ... ``` Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24828 llvm-svn: 282247
* Fix compiler warnings.Haojian Wu2016-09-211-3/+3
| | | | llvm-svn: 282074
* [clang-move] A prototype tool for moving class definition to new file.Haojian Wu2016-09-212-0/+254
Summary: This patch introduces a new tool which moves a specific class definition from files (.h, .cc) to new files (.h, .cc), which mostly acts like "Extract class defintion". In the long term, this tool should be merged in to clang-refactoring as a subtool. clang-move not only moves class definition, but also moves all the forward declarations, functions defined in anonymous namespace and #include headers to new files, to make sure the new files are compliable as much as possible. To move `Foo` from old.[h/cc] to new.[h/cc], use: ``` clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h -new_cc=new.cc old.cc ``` To move `Foo` from old.h to new.h, use: ``` clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc ``` Reviewers: klimek, djasper, ioeric Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits Differential Revision: https://reviews.llvm.org/D24243 llvm-svn: 282070
OpenPOWER on IntegriCloud