summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* cpp11-migrate: Refactor for driver model of operationEdwin Vane2013-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 -for-compilers command line switch.Guillaume Papin2013-07-291-0/+22
| | | | | | | | | 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
* cp11-migrate: Integration with LibFormatEdwin Vane2013-07-231-1/+1
| | | | | | | | | | | 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-221-1/+1
| | | | | | | | | | 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-221-1/+1
| | | | | | | | | 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
* cpp11-migrate: FileOverrides/Transform refactoring.Tareq A. Siraj2013-07-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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: Add missing file headers in unit testsEdwin Vane2013-07-111-0/+9
| | | | | | Differential: http://llvm-reviews.chandlerc.com/D1124 Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 186093
* Don't use PathV1.h in TransformTest.cpp.Rafael Espindola2013-06-261-34/+41
| | | | llvm-svn: 184958
* cpp11-migrate: Transforms honour header modification flagEdwin Vane2013-06-181-1/+115
| | | | | | | | | | 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-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* cpp11-migrate: Transform now responsible for file content overridingEdwin Vane2013-06-171-4/+37
| | | | | | | | | | | To better support per-translation unit replacements, any real work is being moved out of ActionFactory and into Transform. In this revision, that means file override application. For simplification, Transform no longer inherits from SourceFileCallbacks. TransformTest required updating as a result. llvm-svn: 184098
* Revert "sys::Path::GetCurrentDirectory has been removed. Use ↵Rafael Espindola2013-06-141-20/+17
| | | | | | | | | | | sys::fs::current_path." This reverts commit r184004. This test has some dependency on the behavior of the old function on windows. I added it back to llvm for now. llvm-svn: 184010
* sys::Path::GetCurrentDirectory has been removed. Use sys::fs::current_path.Rafael Espindola2013-06-141-17/+20
| | | | llvm-svn: 184004
* cpp11-migrate: Replace file override containerEdwin Vane2013-06-131-2/+2
| | | | | | | | | | | | 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
* More build fixes.Rafael Espindola2013-06-111-0/+1
| | | | llvm-svn: 183785
* cpp11-migrate: Refactor how global options are passed to TransformsEdwin Vane2013-06-061-5/+8
| | | | | | | | | 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: Transforms collect timing data.Edwin Vane2013-05-301-3/+90
| | | | | | | | | | 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
* Updating cpp11-migrate unit testsEdwin Vane2013-04-051-0/+50
With the lib-ification of cpp11-migrate, real unit tests can be written. Replacing dummy tests with some simple tests for the Transform public interface. llvm-svn: 178900
OpenPOWER on IntegriCloud