summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/cpp11-migrate/tool
Commit message (Collapse)AuthorAgeFilesLines
* Rename cpp11-migrate to clang-modernize.Chandler Carruth2013-09-043-593/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason to expect this tool to be limited to C++11, it seems very likely to be of on-going interest. It seems likely to be useful for modernizing even as new libraries come out in TSes and other formats than a complete standard. Fundamentally, we need something a bit more general. After some discussion on the list, going with 'clang-modernize'. I've tried to do a reasonably comprehensive job of fixing up the names, but I may still have missed some. Feel free to poke me if you spot any fallout here. Things I've tried reasonably hard to find and fix: - cpp11-migrate -> clang-modernize - Migrator -> Modernizer - Clean up the introductory documentation that was C++11 specific. I'll also point out that this tool continues to delight me. =] Also, a huge thanks to those who have so carefully, thoroughly documented the tool. The docs here are simply phenomenal. Every tool should be this well documented. I hope I have updated the documentation reasonably well, but I'm not very good at documentation, so review much appreciated. llvm-svn: 189960
* Rename clang-replace -> clang-apply-replacementsEdwin Vane2013-09-033-4/+4
| | | | | | | | Made changes throughout clang-tools-extra for the renaming of clang-replace to clang-apply-replacements as per feedback from community. llvm-svn: 189832
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-09-033-83/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-commit of r189691 and r189689 now with a proper autoconf fix. Massive simplification of how replacements and file overrides are handled by the migrator: * Sources and headers are all treated the same. * All replacements for a given translation unit are stored in the same TranslationUnitReplacements structure. * Change tracking is updated only from main file; no need for propagating "is tracking" flag around. * Transform base class no longer responsible for applying replacements. They are simply stored and main() looks after deduplication and application. * Renamed -yaml-only to -serialize-replacements. Same restrictions apply: Can only request one transform. New restriction: formatting cannot also be turned on since it's basically a transform. * If -serialize-replacements is requested, changes to files will not be applied on disk. * Changed behaviour of function generating names for serialized replacements: Only the main source file goes into the name of the file since a file may contain changes for multiple different files. * Updated HeaderReplacements LIT test for new serialization behaviour. * Replaced old test that ensures replacements are not serialized if -serialize-replacements is not provided. New version ensures changes are made directly to all files in the translation unit. * Updated unit tests. * Due to major simplification of structures in FileOverrides.h, the FileOverridesTest is quite a bit simpler now. llvm-svn: 189798
* Revert "cpp11-migrate: Fixing autoconf build after adding libclangReplace ↵Michael Gottesman2013-08-303-149/+83
| | | | | | | | | | | | | | | | | dependency" Revert "cpp11-migrate: Refactor for driver model of operation" This reverts commit r189691. This reverts commit r189689. This was breaking the phase 1 OS X build for ~2 hours. https://smooshbase.apple.com/buildbot-internal/builders/phase1%20-%20sanity/builds/9559 I reverted the latter commit since I think the latter depended on the former. llvm-svn: 189700
* cpp11-migrate: Fixing autoconf build after adding libclangReplace dependencyEdwin Vane2013-08-301-2/+2
| | | | llvm-svn: 189691
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-08-302-81/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Massive simplification of how replacements and file overrides are handled by the migrator: * Sources and headers are all treated the same. * All replacements for a given translation unit are stored in the same TranslationUnitReplacements structure. * Change tracking is updated only from main file; no need for propagating "is tracking" flag around. * Transform base class no longer responsible for applying replacements. They are simply stored and main() looks after deduplication and application. * Renamed -yaml-only to -serialize-replacements. Same restrictions apply: Can only request one transform. New restriction: formatting cannot also be turned on since it's basically a transform. * If -serialize-replacements is requested, changes to files will not be applied on disk. * Changed behaviour of function generating names for serialized replacements: Only the main source file goes into the name of the file since a file may contain changes for multiple different files. * Updated HeaderReplacements LIT test for new serialization behaviour. * Replaced old test that ensures replacements are not serialized if -serialize-replacements is not provided. New version ensures changes are made directly to all files in the translation unit. * Updated unit tests. * Due to major simplification of structures in FileOverrides.h, the FileOverridesTest is quite a bit simpler now. Differential Revision: http://llvm-reviews.chandlerc.com/D1545 llvm-svn: 189689
* cpp11-migrate: Add Pass-By-Value TransformGuillaume Papin2013-08-293-0/+7
| | | | | | | | | | Currently only constructor parameters stored in class-local storage are modified to make use of the pass-by-value idiom but this is a base that can be be further improved to handle more situations. This commit is the same as r189363 with additionnal fixes for the build issues. llvm-svn: 189584
* Temporarily revert r189363 as it seems to be failing to build.Eric Christopher2013-08-273-7/+0
| | | | llvm-svn: 189387
* cpp11-migrate: Add Pass-By-Value TransformGuillaume Papin2013-08-273-0/+7
| | | | | | | | Currently only constructor parameters stored in class-local storage are modified to make use of the pass-by-value idiom but this is a base that can be be further improved to handle more situations. llvm-svn: 189363
* cpp11-migrate: Use Replacement serialization from clang::toolingEdwin Vane2013-08-201-2/+2
| | | | | | | | Serialization of replacements has been moved to clang::tooling. Differential Revision: http://llvm-reviews.chandlerc.com/D1423 llvm-svn: 188820
* Use -std=c++11 when no compilation database is providedAriel J. Bernal2013-08-161-7/+29
| | | | | | | | Allow the migrator to be used without specifing --. If neither -- nor -p is provided and no compilation database can be detecteded from the first source file path then -std=c++11 is added as the only compiler argument. llvm-svn: 188533
* cpp11-migrate: Remove mention of 'headers' from serialization codeEdwin Vane2013-08-141-2/+2
| | | | | | | | | | | | | * HeaderChangeDocument -> MigratorDocument * HeaderFileName -> TargetFile * SourceFileName -> MainSourceFile * Removed TransformID * Comments updated, at least with respect to serialization * Unit tests updated. Differential Revision: http://llvm-reviews.chandlerc.com/D1403 llvm-svn: 188404
* cpp11-migrate: Fix silly logic error preventing multiple transformsEdwin Vane2013-08-141-1/+2
| | | | | | | A missed clause in an error test added in r188371 caused any use of the migrator requesting multiple transforms to fail. llvm-svn: 188374
* cpp11-migrate: Adding -yaml-only optionEdwin Vane2013-08-141-37/+51
| | | | | | | | | | | For use with -headers, -yaml-only will cause cpp11-migrate to not write header changes to disk and instead write them as header change description files. This option facilitiates upcoming functionality to properly support changing headers as part of migration. Differential Revision: http://llvm-reviews.chandlerc.com/D1385 llvm-svn: 188371
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-08-131-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | Another attempt to commit r187204 after windows related problems has been fixed. Note that changes to this patch reflect the current behavior of cpp11-migrate. Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the header file - Name of the source file that included the header file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the HeaderChangeDocument struct. Differential Revision: http://llvm-reviews.chandlerc.com/D1369 llvm-svn: 188274
* Revert "cpp11-migrate: Write header replacements to disk"Rafael Espindola2013-07-301-29/+2
| | | | | | | This reverts commit 187428. It broke the windows bots. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/3450 llvm-svn: 187447
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-07-301-2/+29
| | | | | | | | | | | | | | | | | | | | Committing r187204 with fixes for darwin. Note that one of the lit tests are disabled on windows due to a bug in writing header replacements to file. Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the TransformDocument struct. llvm-svn: 187428
* cpp11-migrate: Add -for-compilers command line switch.Guillaume Papin2013-07-291-8/+82
| | | | | | | | | This change add a new option command line option -for-compilers that allows the user to enable multiple transforms automatically. Another difference is that now all transforms are enabled by default. llvm-svn: 187360
* Revert "cpp11-migrate: Write header replacements to disk"Rafael Espindola2013-07-261-36/+2
| | | | | | | | This reverts commit 187204. It broke the freebsd bots: http://lab.llvm.org:8011/builders/clang-X86_64-freebsd/builds/9561 llvm-svn: 187227
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-07-261-2/+36
| | | | | | | | | | | | | | | | | | | Header replacements are now written to disk in YAML format for an external tool to merge. A unique file will be created in the same directory as the header with all replacements that came from a source file that included the header file. The YAML file will have: - Name of the file - Transform ID that generated the replacement - Offset - Length - Replacement text Any tool reading these replacements should read them using the TransformDocument struct. Differential Revision: http://llvm-reviews.chandlerc.com/D1142 llvm-svn: 187204
* cpp11-migrate: Register the transforms automatically using llvm::RegistryGuillaume Papin2013-07-241-22/+16
| | | | | | | With this change each transform now register a factory. The factories are registered using an llvm::Registry which makes them available globally. llvm-svn: 187041
* cp11-migrate: Integration with LibFormatEdwin Vane2013-07-232-7/+70
| | | | | | | | | | | Adding a feature to optionally reformat code changed by the migrator. Like LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium) or use a YAML-format config file. Now with no dependency on iostream by the Reformatting.cpp LIT test. Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 186938
* Revert "cp11-migrate: Integration with LibFormat"Michael Gottesman2013-07-222-70/+7
| | | | | | | | | | This reverts commit r186866. This breaks the build and the original author Guillaume Papin <guillaume.papin@epitech.eu> asked me to revert so he could look at it more with revane. llvm-svn: 186873
* cp11-migrate: Integration with LibFormatEdwin Vane2013-07-222-7/+70
| | | | | | | | | Adding a feature to optionally reformat code changed by the migrator. Like LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium) or use a YAML-format config file. Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 186866
* Update for llvm API change.Rafael Espindola2013-07-161-2/+2
| | | | llvm-svn: 186449
* cpp11-migrate: FileOverrides/Transform refactoring.Tareq A. Siraj2013-07-121-13/+18
| | | | | | | | | | | | | | | | | | | | | | This commit include the following changes: - SourceOverrides is now a class - it simplifies the usage for the Transform class, since now the replacements can be applied directly to the file overrides with SourceOverrides::applyReplacements(). - it contains a method applyRewrites() which was previously named collectResults() in Transform.cpp. The method has been "optimized" a bit to re-use the allocated buffer (std::string::clear() is called). - since the class has some logic it's now unit tested - Now FileOverrides is a class (not a std::map typedef) and store pointers to the SourceOverrides. The reason is that the SourceOverrides can't be copied anymore (which was already something to avoid since it's can be a quite large object). Author: Guillaume Papin <guillaume.papin@epitech.eu> Differential Revision: http://llvm-reviews.chandlerc.com/D1122 llvm-svn: 186161
* cpp11-migrate: Tidying upEdwin Vane2013-07-081-11/+10
| | | | | | | | | | | | * Some file headers were missing for files in Core/ * Some headers were included but not necessary * CMakeLists.txt was linking in LLVMSupport even though CMakeLists in subdirs were linking it in too. * StringRefisation of constructors of types in FileOverrides.h * Other misc cleanups Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 185811
* cpp11-migrate: Minor command-line fixes and improvementsEdwin Vane2013-07-041-1/+17
| | | | | | | | | | | * all transforms are in the same category * all transforms' options are in the same category * display the CommonOptionParser extra-help (which describe in more details the compilation database stuff) * add EXAMPLES section Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 185660
* cpp11-migrate: Add Replace-AutoPtr TransformEdwin Vane2013-07-033-0/+10
| | | | | | | | | | | | Add a new transform to replace uses of 'std::auto_ptr' by 'std::unique_ptr'. Copy-ctor and assign-operator are wrapped with a call to 'std::move()'. Note that until header modification is ready it is not that useful, that's why it's marked as (EXPERIMENTAL) in the command line description and a "Known Limitations" section is present in the transform documentation. Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 185535
* cpp11-migrate: Transforms honour header modification flagEdwin Vane2013-06-181-3/+0
| | | | | | | | | | Transforms will now make changes to headers if header modifications have been enabled. FIXME: Only UseNullptr contains a cursory header modification test. Other transforms should have them too. llvm-svn: 184197
* cpp11-migrate: Transform now responsible for applying replacementsEdwin Vane2013-06-181-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | To make it possible for replacements made to headers as part of transforming one translation unit to not be visible to the transform of other translation units, Transform now handles replacement application as part of its end-of-source handling. Several things were simplified as a result: - The duplicated code in every transform for applying replacements is now gone and replaced with one location in Transform. - RefactoringTool is no longer used since Transform houses the Replacements structure. - RewriterContainer is now a private implementation detail of Transform (also renamed to RewriterManager since its behaviour is slightly different now with respect to lifetime of objects). - There's now no distinction between input and output file state. Misc notes: - Interface changes reflected in unit tests. - Replacements for files other than the main file are assumed to be for headers and stored as such. llvm-svn: 184194
* Add a dependency on LLVM's option library for clang-tools-extraReid Kleckner2013-06-141-1/+1
| | | | | | r183989 added a dependency on LLVMOption in clangFrontend. llvm-svn: 183990
* Also install cpp11-migrate when built with cmake. Fixes bug #16296Sylvestre Ledru2013-06-141-0/+3
| | | | llvm-svn: 183976
* cpp11-migrate: Add headers to file override informationEdwin Vane2013-06-131-0/+13
| | | | | | | | | | | File override structures now contain per-source overrides for headers. For now, modified headers are written to disk when the Migrator is done. This is only temporary behaviour since we can expect headers to be changed by migrating multiple source files. The changes need to be merged after all migrations are complete. llvm-svn: 183917
* cpp11-migrate: Replace file override containerEdwin Vane2013-06-131-32/+9
| | | | | | | | | | | | A more flexible container for storing overrides is required for headers. Before a source goes through the transform pipeline, any headers it references will be in their original state and unaffected by transforms applied to other sources. Therefore overrides for headers need to be kept separate for each source file. This patch doesn't introduce support for storing header overrides yet. It only replaces the existing structure and makes any necessary changes to support it. llvm-svn: 183910
* cpp11-migrate: Add EnableHeaderModification flagEdwin Vane2013-06-061-0/+18
| | | | | | | | First step toward supporting header modifications: adding a flag that turns on such modifications. Eventually header modifications will be on by default but until all the kinks can be worked out, they must be explicitly enabled. llvm-svn: 183444
* cpp11-migrate: Refactor how global options are passed to TransformsEdwin Vane2013-06-061-7/+10
| | | | | | | | | Refactored how global options are passed to Transforms to avoid widespread changes every time a new global option is added. Tests updated to reflect new interface. llvm-svn: 183443
* cpp11-migrate: Eliminate windows line endingsEdwin Vane2013-06-051-196/+196
| | | | | | | r183274 accidentally added windows line endings to changed lines. Changing them back. llvm-svn: 183322
* cpp11-migrate: collect performance timers per source fileEdwin Vane2013-06-041-252/+196
| | | | | | | | Performance timers captured in each transform for all files they process are now collected and arranged per source file in preparation for writing to disk. This revision is the last piece of the initial implementation of performance timer capturing. llvm-svn: 183274
* cpp11-migrate: turn off PID-based perf data filenamesEdwin Vane2013-06-031-2/+6
| | | | | | | Getting PIDs on Windows is broken. Proper fix is simple but requires testing so just disabling PID-based file names for now. llvm-svn: 183154
* Add support for report execution timesAriel J. Bernal2013-06-031-1/+78
| | | | | | | | -Added command line option -report-times to enable or disable the output. The same option can be used to specify the output directory. -Write timing data to a unique file in disk using json format. llvm-svn: 183142
* Tweak autoconf link params to fix migrator buildEdwin Vane2013-05-301-4/+3
| | | | llvm-svn: 182957
* cpp11-migrate: Transforms collect timing data.Edwin Vane2013-05-301-1/+1
| | | | | | | | | | Using updated form of newFrontendActionFactory(), Transforms now automatically measure, if requested, how long it takes to apply a MatchFinder to a source file. Other per-transform overhead, e.g. applying replacements, is not currently measured. This behaviour is disabled for now and soon will be connected to a new command line arg. llvm-svn: 182942
* Add support to read include/exclude paths from fileEdwin Vane2013-05-021-2/+10
| | | | | | | | | | | | | | Files containing the list of paths to be included and excluded can now be specified through -include-from=<filename> and -exclude-from=<filename> command line options in cpp11-migrate. Added support for data files for cpp11-migrate unittests. The Cpp11MigrateTests executable just requires a DATADIR environment variable to be set which specifies the directory where data files are stored. This is handled automatically when using LIT. Author: Jack Yang <jack.yang@intel.com>, Edwin Vane <edwin.vane@intel.com> llvm-svn: 180939
* Allow autotools to build and install cpp11-migrateAriel J. Bernal2013-04-291-1/+0
| | | | | | | | This patch fixes bug15793 cpp11-migrate was built but not installed (make install) in the autotools build. llvm-svn: 180721
* Adding support for -include/-exclude to cpp11-migrateEdwin Vane2013-04-151-0/+11
| | | | | | | | | | | This commit adds initial support for the -include/-exclude options which are both currently marked as hidden. This support is the first step toward supporting transformations in headers included from source files. Added unittests to test include/exclude support. Author: Jack Yang <jack.yang@intel.com> llvm-svn: 179528
* Adding the AddOverride transform for cpp11-migrateEdwin Vane2013-04-093-0/+9
| | | | | | | | This transform adds the override specifier to methods that overrides virtual methods from a base class that don't already have this specifier. Author: Philip Dunstan <phil@phildunstan.com> llvm-svn: 179127
* Fix symbol dependency errors introduced with libmigrateCoreEdwin Vane2013-04-051-1/+13
| | | | | | | | | | With cpp11-migrate core functionality moved to a separate library (for enabling unit tests) this library contained code that referenced symbols that are still in the main binary. On some platforms, the shared library build broke as a result. This revision fixes the dependency problem and is safe for the eventual lib-ification of the transforms as well. llvm-svn: 178901
* lib-ified core cpp11-migrate functionality to support unit testsEdwin Vane2013-04-043-0/+218
Summary: Transform.* and Transforms.* moved to form a new library: libmigrateCore. #includes updated to point to new header locations. To support autoconf build, Cpp11Migrate.cpp moved to new subdirectory 'tool' which also contains build files for creating final binary. CMake and autoconf updated to build the new library and link it with cpp11-migrate and with cpp11-migrate unit tests. Dummy unit tests replaced with simple, but real, tests for Transform's public interface. TODO: Lib-ifying the transforms to further simplify build of cpp11-migrate. llvm-svn: 178785
OpenPOWER on IntegriCloud