summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/RefactoringTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added formatAndApplyAllReplacements that works on multiple files in libTooling.Eric Liu2016-03-291-1/+35
| | | | | | | | | | | | | | Summary: formatAndApplyAllReplacements takes a set of Replacements, applies them on a Rewriter, and reformats the changed code. Reviewers: klimek, djasper Subscribers: ioeric, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D17852 llvm-svn: 264745
* Add functions to apply replacements and reformat them.Manuel Klimek2016-03-011-0/+19
| | | | | | | | | | | | | | | | This is a commonly useful feature to have, and we have implemented it multiple times with different kinds of bugs. This implementation centralizes the idea in a set of functions that we can then use from the various tools. Reverts r262234, which is a revert of r262232, and puts the functions into FOrmat.h, as they are closely coupled to clang-format, and we otherwise introduce a cyclic dependency between libFormat and libTooling. Patch by Eric Liu. llvm-svn: 262323
* Revert "Implement new interfaces for code-formatting when applying ↵Manuel Klimek2016-02-291-49/+0
| | | | | | | | replacements." This reverts commit r262232. llvm-svn: 262234
* Implement new interfaces for code-formatting when applying replacements.Manuel Klimek2016-02-291-0/+49
| | | | | | Patch by Eric Liu. llvm-svn: 262232
* Fix calculation of shifted cursor/code positions. Specifically supportDaniel Jasper2015-11-231-6/+15
| | | | | | | | | the case where a specific range is replaced by new text. Previously, the calculation would shift any position from within a replaced region to the first character after the region. This is undersirable, e.g. for clang-format's include sorting. llvm-svn: 253859
* clang-format: Add initial #include sorting capabilities.Daniel Jasper2015-09-231-0/+93
| | | | | | | | | To implement this nicely, add a function that merges two sets of replacements that are meant to be done in sequence. This functionality will also be useful for other applications, e.g. formatting the result of clang-tidy fixes. llvm-svn: 248367
* Allow replacements created from token ranges to specify language options.Manuel Klimek2015-06-031-0/+25
| | | | | | | | The default language options will lead to incorrect replacements in C++ code, for example when trying to replace nested name specifiers ending in "::". llvm-svn: 238922
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-4/+4
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-1/+2
| | | | llvm-svn: 222306
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-3/+2
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Tooling: Ignore file names in tooling::deduplicate.Benjamin Kramer2014-09-091-2/+6
| | | | | | | | | | | This was horribly broken due to how the sort predicate works. We would report a conflict for files with a replacement in the same position but different names if the length differed. Just ignore paths as this is often what the user wants. Files can occur with different names (due to symlinks or relative paths) and we don't ever want to do the same edit in one file twice. llvm-svn: 217439
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-101-3/+4
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-4/+3
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-3/+4
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-3/+2
| | | | llvm-svn: 210780
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-2/+2
| | | | llvm-svn: 210423
* Fix two test-only leaks found by LSan.Nico Weber2014-04-241-1/+3
| | | | | | | | | The result of getBufferForFile() must be freed. (Should we change functions that expect the caller to assume ownership so that they return unique_ptrs instead? Then the type system makes sure we get this right.) llvm-svn: 207074
* Reverted r192992 broke windows and freebsd builds.Ariel J. Bernal2013-10-181-46/+0
| | | | llvm-svn: 192997
* This patch fixes replacements that are not applied when relative paths areAriel J. Bernal2013-10-181-0/+46
| | | | | | | | | | specified. In particular it makes sure that relative paths for non-virtual files aren't made absolute. Added unittest. llvm-svn: 192992
* Revert commit r192299 until find a way to account for simlinks in OS X.Ariel J. Bernal2013-10-091-53/+0
| | | | llvm-svn: 192313
* This patch fixes replacements that are not applied when relative paths areAriel J. Bernal2013-10-091-0/+53
| | | | | | | | | | specified. In particular it makes sure that relative paths for non-virtual files aren't made absolute. Added unittest test. llvm-svn: 192299
* Adding a vector version of clang::tooling::shiftedCodePosition().Edwin Vane2013-08-271-0/+19
| | | | | | | | | During the transition of clang::tooling::Replacements from std::set to std::vector, functions such as clang::tooling::applyAllReplacements() have been duplicated to take a std::vector<Replacement>. Applying this same temporary duplication to clang::tooling::shiftedCodePosition(). llvm-svn: 189358
* Have Range::overlapsWith use positive logicEdwin Vane2013-08-131-0/+1
| | | | | | Improved test to catch missing case. llvm-svn: 188304
* Adding a vector version of tooling::applyAllReplacementsEdwin Vane2013-08-131-0/+15
| | | | | | | | | | | One day soon, tooling::Replacements will be changed from being implemented as an std::set to being implemented as an std::vector. Until then, some new code using vectors of Replacements would enjoy having a version of applyAllReplacements that takes a vector. Differential Revision: http://llvm-reviews.chandlerc.com/D1380 llvm-svn: 188295
* Fixing a conflict detection bug in tooling::deduplicateEdwin Vane2013-08-131-6/+11
| | | | | | | | If a Replacment is contained within the conflict range being built, the conflict range would be erroneously shortened. Now fixed. Tests updated to catch this case. llvm-svn: 188287
* Introduce Replacement deduplication and conflict detection functionEdwin Vane2013-08-081-0/+71
| | | | | | | | | | Summary: This patch adds tooling::deduplicate() which removes duplicates from and looks for conflicts in a vector of Replacements. Differential Revision: http://llvm-reviews.chandlerc.com/D1314 llvm-svn: 187979
* Adds overlapsWith and contains predicates on tooling::Range.Manuel Klimek2013-07-191-0/+15
| | | | | | Patch by Guillaume Papin. llvm-svn: 186670
* Use llvm::sys::fs::createTemporaryFile.Rafael Espindola2013-07-051-1/+1
| | | | llvm-svn: 185717
* Remove last use of PathV1.h from clang.Rafael Espindola2013-06-261-19/+25
| | | | | | | Instead of creating a temporary directory, remember the set of temporary files we create. llvm-svn: 184951
* Include PathV1.h in a file that uses it.Rafael Espindola2013-06-111-0/+1
| | | | llvm-svn: 183786
* Let clang-format move the cursor appropriately.Daniel Jasper2013-05-211-0/+24
| | | | | | | | | With this patch, clang-format will try to keep the cursor at the original code position in editor integrations (implemented for emacs and vim). This means, after formatting, clang-format will try to keep the cursor on the same character of the same token. llvm-svn: 182373
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-2/+2
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Sort the #include lines for unittests/...Chandler Carruth2012-12-041-2/+2
| | | | | | I've tried to place sensible headers at the top as main-module headers. llvm-svn: 169243
* Buildbot debugging is funDouglas Gregor2012-10-231-1/+1
| | | | llvm-svn: 166516
* Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.Ted Kremenek2012-09-011-1/+1
| | | | | | | This is similar to how we divide up the StaticAnalyzer libraries to separate core functionality to what is clearly associated with Frontend actions. llvm-svn: 163050
* Update unittests for include change.Benjamin Kramer2012-07-041-0/+1
| | | | llvm-svn: 159724
* Adds the Refactoring library, which is a layer on top of the Tooling libraryManuel Klimek2012-05-231-0/+304
that allows easy refactoring across translation units. llvm-svn: 157331
OpenPOWER on IntegriCloud