Commit Graph

4 Commits

Author SHA1 Message Date
Tareq A. Siraj e0a03c3c64 cpp11-migrate: FileOverrides/Transform refactoring.
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
2013-07-12 14:36:20 +00:00
Edwin Vane aae33677f5 cpp11-migrate: Tidying up
* 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
2013-07-08 12:17:37 +00:00
Edwin Vane 62c013db6c cpp11-migrate: Transform now responsible for applying replacements
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
2013-06-18 15:31:01 +00:00
Edwin Vane e0a7d9ceff cpp11-migrate: Replace file override container
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
2013-06-13 16:00:46 +00:00