summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/cpp11-migrate
Commit message (Collapse)AuthorAgeFilesLines
* Rename cpp11-migrate to clang-modernize.Chandler Carruth2013-09-0465-7878/+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-036-7/+7
| | | | | | | | 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-0337-598/+475
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3037-475/+598
| | | | | | | | | | | | | | | | | 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-302-3/+3
| | | | llvm-svn: 189691
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-08-3035-595/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2910-0/+534
| | | | | | | | | | 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-2710-534/+0
| | | | llvm-svn: 189387
* cpp11-migrate: Add Pass-By-Value TransformGuillaume Papin2013-08-2710-0/+534
| | | | | | | | 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: Add a class to support include directives modificationsGuillaume Papin2013-08-273-0/+616
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r189037 (buildbot failures on Windows). llvm-svn: 189354
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-223-616/+0
| | | | | | | | | | This reverts commit r189017. It broke the windows bots: - http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/4176 - http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/3837 llvm-svn: 189037
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-223-0/+616
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r188791 (buildbot failures on Windows). llvm-svn: 189017
* Adjust for r188968.Eli Friedman2013-08-222-2/+2
| | | | llvm-svn: 188970
* cpp11-migrate: Use Replacement serialization from clang::toolingEdwin Vane2013-08-205-124/+20
| | | | | | | | Serialization of replacements has been moved to clang::tooling. Differential Revision: http://llvm-reviews.chandlerc.com/D1423 llvm-svn: 188820
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-203-616/+0
| | | | | | | | This reverts commit r188791. The Windows bots are still broken. llvm-svn: 188795
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-203-0/+616
| | | | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. This should fix the reverted commit r188610 (buildbot failures on Windows). llvm-svn: 188791
* Revert "cpp11-migrate: Add a class to support include directives modifications"Guillaume Papin2013-08-173-616/+0
| | | | | | | | | This reverts commit r188610. Issue with the absolute include paths not found in the unit tests on the Windows bots. Needs investigation. llvm-svn: 188611
* cpp11-migrate: Add a class to support include directives modificationsGuillaume Papin2013-08-173-0/+616
| | | | | | | | | The IncludeDirectives class helps with detecting and modifying #include directives. For now it allows the users to add angled-includes in a source file. This is a start for this class that will evolve in the future to add more functionality. llvm-svn: 188610
* 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-147-42/+40
| | | | | | | | | | | | | * 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: Fixing doxygen warningsTareq A. Siraj2013-08-142-3/+4
| | | | | | | | | | | | | For some reason doxygen doesn't seem to like the using namespace clang::tooling in the source file and complaints about missing class members. Also fixed missing parameter documentation for TransformName in SourceOverrides::applyReplacements(). Differential Revision: http://llvm-reviews.chandlerc.com/D1400 llvm-svn: 188394
* 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
* \param is not for referring to arguments.Benjamin Kramer2013-08-141-1/+1
| | | | | | Found by -Wdocumentation. llvm-svn: 188368
* cpp11-migrate: Write header replacements to diskTareq A. Siraj2013-08-136-45/+239
| | | | | | | | | | | | | | | | | | | | | | | | 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
* cpp11-migrate: Fixed path problem with include/exclude pathsTareq A. Siraj2013-08-092-7/+15
| | | | | | | | | | This fixes a problem when the path separator in the include/exclude directory is different (e.g. "\" vs. "/") from the path separator in the file path we are modifying. Differential Revision: http://llvm-reviews.chandlerc.com/D1326 llvm-svn: 188094
* Fixed path differences when using include/exclude headersAriel J. Bernal2013-07-311-6/+34
| | | | | | Added function for removing relative operators from input paths. llvm-svn: 187481
* Revert "cpp11-migrate: Write header replacements to disk"Rafael Espindola2013-07-306-251/+45
| | | | | | | 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-306-45/+251
| | | | | | | | | | | | | | | | | | | | 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-2910-14/+252
| | | | | | | | | 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-266-258/+45
| | | | | | | | 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-266-45/+258
| | | | | | | | | | | | | | | | | | | 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
* Fix doxygen warningsAriel J. Bernal2013-07-241-2/+3
| | | | | | | | Doxygen doesn't recognize <blockquote> html tags. Added support for <blockquote> and Markdown was introduce with doxygen 1.8.0. This patch replaces blockquote with \par for compatibility with previous versions. llvm-svn: 187067
* cpp11-migrate: Register the transforms automatically using llvm::RegistryGuillaume Papin2013-07-2410-49/+148
| | | | | | | 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
* test commitGuillaume Papin2013-07-241-2/+1
| | | | llvm-svn: 187038
* Fix doxygen warningsAriel J. Bernal2013-07-231-3/+4
| | | | | | | | | It seems that doxygen fails to find overloaded methods when the parameters are not in sync with the method declaration. Added the fully-qualifed type to the parameters method definition although it's not necessary since the using directive is in effect. llvm-svn: 186948
* cp11-migrate: Integration with LibFormatEdwin Vane2013-07-237-15/+390
| | | | | | | | | | | 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-227-390/+15
| | | | | | | | | | 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-227-15/+390
| | | | | | | | | 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
* Fix UseAuto not transforming iterator when non-fully qualifiers are used andAriel J. Bernal2013-07-153-49/+69
| | | | | | | | | | | | using inline namespaces is specified. UseAuto used to fail to transform iterators when using inline namespaces and non-fully qualified types, relying on a using directive previously declared. - This fix uses the already define isFromStdNamespace matcher. - Fixed tests and added a new test using inline namespaces. - Added CustomMatchers to reuse common matchers among transforms. llvm-svn: 186327
* cpp11-migrate: FileOverrides/Transform refactoring.Tareq A. Siraj2013-07-127-150/+198
| | | | | | | | | | | | | | | | | | | | | | 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
* Generate a unique filename for a given headerTareq A. Siraj2013-07-102-0/+60
| | | | | | | | | | This patch is in preparation for writing the header replacement to disk. Added getUniqueHeaderName() that generates a unique header filename in the same directory as the header file. Differential Revision: http://llvm-reviews.chandlerc.com/D1104 llvm-svn: 186007
* cpp11-migrate: Fixes for r185811Edwin Vane2013-07-082-2/+3
| | | | | | | | Some changes to r185811 broke certain build configurations. These changes should fix them. Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 185814
* cpp11-migrate: Tidying upEdwin Vane2013-07-0847-169/+232
| | | | | | | | | | | | * 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-046-11/+38
| | | | | | | | | | | * 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-039-0/+504
| | | | | | | | | | | | 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
* Don't use PathV1.h in PerfSupport.cpp.Rafael Espindola2013-06-261-4/+3
| | | | llvm-svn: 184956
* cpp11-migrate: Really fixing doxygen warningEdwin Vane2013-06-251-0/+1
| | | | | | Last attempt at this fix was bogus. llvm-svn: 184869
* cpp11-migrate: Fixing doxygen warningEdwin Vane2013-06-191-1/+0
| | | | llvm-svn: 184326
OpenPOWER on IntegriCloud