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
* 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
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
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