summaryrefslogtreecommitdiff
path: root/tools/clang-refactor
Commit message (Collapse)AuthorAgeFilesLines
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-093-3/+3
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-3/+1
| | | | | | | | | | | | std::unique_ptr<>" This reverts commit rL326201 This broke gcc4.8 builds, compiler just segfaults:¬ http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬ http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326204 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | std::unique_ptr<> Summary: Noticed during review of D41102. I'm not sure whether there are any principal reasons why it returns raw owning pointer, or it is just a old code that was not updated post-C++11. I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason, but it does not //appear// asif those failures are related to these changes. This is clang part. Clang-tools-extra part is D43780. Reviewers: klimek, bkramer, alexfh, pcc Reviewed By: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D43779 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326201 91177308-0d34-0410-b5e6-96231b3b80d8
* [cmake] Delete redundant install command for clang-refactor.Don Hinton2018-01-101-2/+0
| | | | | | | | | | | | | Summary: Install targets for clang tools are controlled by CLANG_BUILD_TOOLS, and when OFF, cmake issues the following warning: WARNING: Target "clang-refactor" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case. Differential Revision: https://reviews.llvm.org/D41807 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322147 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319840 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Introduce a new rename rule for qualified symbolsHaojian Wu2017-11-081-40/+35
| | | | | | | | | | | | | | Summary: Prototype of a new rename rule for renaming qualified symbol. Reviewers: arphaman, ioeric, sammccall Reviewed By: arphaman, sammccall Subscribers: jklaehn, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39332 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317672 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Use ClangTool more explicitly by making refaroing actions ↵Eric Liu2017-11-071-126/+192
| | | | | | | | | | | | | | | | AST frontend actions. Summary: This is a refactoring change. NFC Reviewers: arphaman, hokein Reviewed By: arphaman, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39675 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317577 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Use add_clang_tool CMake templatePetr Hosek2017-10-251-1/+1
| | | | | | | | | This allows including clang-refactor in LLVM_DISTRIBUTION_COMPONENTS to build clang-refactor as part of the toolchain distribution. Differential Revision: https://reviews.llvm.org/D39266 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316540 91177308-0d34-0410-b5e6-96231b3b80d8
* [refactor] Initial outline of implementation of "extract function" refactoringAlex Lorenz2017-10-241-11/+54
| | | | | | | | | | | | | | | | | | | | This commit adds an initial, skeleton outline of the "extract function" refactoring. The extracted function doesn't capture variables / rewrite code yet, it just basically does a simple copy-paste. The following initiation rules are specified: - extraction can only be done for executable code in a function/method/block. This means that you can't extract a global variable initialize into a function right now. - simple literals and references are not extractable. This commit also adds support for full source ranges to clang-refactor's test mode. Differential Revision: https://reviews.llvm.org/D38982 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316465 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Add "-Inplace" option to the commandline tool.Haojian Wu2017-10-201-6/+16
| | | | | | | | | | | | | | | | | Summary: Change clang-refactor default behavior to print the new code after refactoring (instead of editing the source files), which would make it easier to use and debug the refactoring action. Reviewers: arphaman, ioeric Reviewed By: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39092 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316212 91177308-0d34-0410-b5e6-96231b3b80d8
* [refactor] allow the use of refactoring diagnosticsAlex Lorenz2017-10-164-16/+89
| | | | | | | | | | This commit allows the refactoring library to use its own set of refactoring-specific diagnostics to reports things like initiation errors. Differential Revision: https://reviews.llvm.org/D38772 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315924 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-refactor: Use llvm_unreachable in an unused overrideAlex Lorenz2017-10-161-1/+1
| | | | | | | As suggested by David Blaikie! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315923 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r315738 "[clang-refactor] Apply source replacements"Alex Lorenz2017-10-161-6/+88
| | | | | | | | | | | | | | | | The fixed commit ensures that ParsedSourceRange works correctly with Windows paths. Original message: This commit actually brings clang-refactor to a usable state as it can now apply the refactoring changes to source files. The -selection option is now also fully supported. Differential Revision: https://reviews.llvm.org/D38402 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315918 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r315738Alex Lorenz2017-10-131-88/+6
| | | | | | | | The ParsedSourceRange class does not work correctly on Windows with the ':' drive separators git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315774 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Woverloaded-virtual warning in clang-refactorAlex Lorenz2017-10-131-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315755 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Apply source replacementsAlex Lorenz2017-10-131-6/+84
| | | | | | | | | | | This commit actually brings clang-refactor to a usable state as it can now apply the refactoring changes to source files. The -selection option is now also fully supported. Differential Revision: https://reviews.llvm.org/D38402 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315738 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r315087 "[refactor] add support for refactoring options"Alex Lorenz2017-10-131-7/+114
| | | | | | | | | | | | | | | | | The recommit fixes a UB bug that occurred only on a small number of bots. Original message: This commit adds initial support for refactoring options. One can now use optional and required std::string options. This commit also adds a NewNameOption for the local-rename refactoring action to allow rename to work with custom names. Differential Revision: https://reviews.llvm.org/D37856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315661 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-refactor] Fix clang-tidy misc-move-const-arg warning.Haojian Wu2017-10-101-2/+2
| | | | | | NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315290 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r315087Alex Lorenz2017-10-061-114/+7
| | | | | | | clang-refactor crashes on some bots after this commit git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315095 91177308-0d34-0410-b5e6-96231b3b80d8
* [refactor] add support for refactoring optionsAlex Lorenz2017-10-061-7/+114
| | | | | | | | | | | | | This commit adds initial support for refactoring options. One can now use optional and required std::string options. This commit also adds a NewNameOption for the local-rename refactoring action to allow rename to work with custom names. Differential Revision: https://reviews.llvm.org/D37856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315087 91177308-0d34-0410-b5e6-96231b3b80d8
* [refactor] Use CommonOptionsParser in clang-refactorAlex Lorenz2017-09-141-45/+13
| | | | | | | | | | This commit ensures that CommonOptionsParser works with subcommands. This allows clang-refactor to use the CommonOptionsParser. Differential Revision: https://reviews.llvm.org/D37618 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313260 91177308-0d34-0410-b5e6-96231b3b80d8
* Link clang-refactor with clangFormatAlex Lorenz2017-09-141-0/+1
| | | | | | | | This is an attempt to fix http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage after r313244. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313252 91177308-0d34-0410-b5e6-96231b3b80d8
* Link clang-refactor with clangAST and clangLexAlex Lorenz2017-09-141-0/+2
| | | | | | | | This is an attempt to fix http://bb.pgr.jp/builders/clang-i686-linux-RA/ after r313244. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313249 91177308-0d34-0410-b5e6-96231b3b80d8
* [refactor] add clang-refactor tool with initial testing support andAlex Lorenz2017-09-144-0/+861
local-rename action This commit introduces the clang-refactor tool alongside the local-rename action which uses the existing renaming engine used by clang-rename. The tool doesn't actually perform the source transformations yet, it just provides testing support. This commit also moves only one test from clang-rename over to test/Refactor. I will continue to move the other tests throughout development of clang-refactor. The following options are supported by clang-refactor: -v: use verbose output -selection: The source range that corresponds to the portion of the source that's selected (currently only special command test:<file> is supported). Please note that a follow-up commit will migrate clang-refactor to libTooling's common option parser, so clang-refactor will be able to use the common interface with compilation database and options like -p, -extra-arg, etc. The testing support provided by clang-refactor is described below: When -selection=test:<file> is given, clang-refactor will parse the selection commands from that file. The selection commands are grouped and the specified refactoring action invoked by the tool. Each command in a group is expected to produce an identical result. The precise syntax for the selection commands is described in a comment in TestSupport.h. Differential Revision: https://reviews.llvm.org/D36574 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313244 91177308-0d34-0410-b5e6-96231b3b80d8