summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-modernize/Core/Transform.h
diff options
context:
space:
mode:
authorEdwin Vane <edwin.vane@intel.com>2013-10-05 12:15:58 +0000
committerEdwin Vane <edwin.vane@intel.com>2013-10-05 12:15:58 +0000
commitc0f00b79f79171b3595f77df8f7fa4cf16365c3b (patch)
treef6fee93270bec60820cb94dbb9aded358a444316 /clang-tools-extra/clang-modernize/Core/Transform.h
parentc83946f7f522c4b45d60f3bac4849f0811e18d30 (diff)
downloadbcm5719-llvm-c0f00b79f79171b3595f77df8f7fa4cf16365c3b.tar.gz
bcm5719-llvm-c0f00b79f79171b3595f77df8f7fa4cf16365c3b.zip
clang-modernize: Apply replacements using clang-apply-replacements
Summary: The clang-apply-replacements process is now invoked to apply replacements between applying transforms. This resulted in a massive simplification of the tool: - FileOverrides class no longer needed. - Change tracking and code formatting no longer needed. - No more dependency on libclangApplyReplacements. - Final syntax check is easier to do directly now than with a separate header/source pair. Replacement handling stuff abstracted into a new header/source pair to de-clutter ClangModernize.cpp somewhat. Tests updated. Differential Revision: http://llvm-reviews.chandlerc.com/D1836 llvm-svn: 192032
Diffstat (limited to 'clang-tools-extra/clang-modernize/Core/Transform.h')
-rw-r--r--clang-tools-extra/clang-modernize/Core/Transform.h27
1 files changed, 7 insertions, 20 deletions
diff --git a/clang-tools-extra/clang-modernize/Core/Transform.h b/clang-tools-extra/clang-modernize/Core/Transform.h
index e74c77f73e6..6265df41325 100644
--- a/clang-tools-extra/clang-modernize/Core/Transform.h
+++ b/clang-tools-extra/clang-modernize/Core/Transform.h
@@ -50,9 +50,6 @@ class MatchFinder;
} // namespace ast_matchers
} // namespace clang
-class FileOverrides;
-
-
// \brief Maps main source file names to a TranslationUnitReplacements
// structure storing replacements for that translation unit.
typedef llvm::StringMap<clang::tooling::TranslationUnitReplacements>
@@ -95,13 +92,13 @@ public:
/// \brief Apply a transform to all files listed in \p SourcePaths.
///
- /// \p Database must contain information for how to compile all files in \p
- /// SourcePaths. \p InputStates contains the file contents of files in \p
- /// SourcePaths and should take precedence over content of files on disk.
- /// Upon return, \p ResultStates shall contain the result of performing this
- /// transform on the files listed in \p SourcePaths.
- virtual int apply(const FileOverrides &InputStates,
- const clang::tooling::CompilationDatabase &Database,
+ /// \param[in] Database Contains information for how to compile all files in
+ /// \p SourcePaths.
+ /// \param[in] SourcePaths list of sources to transform.
+ ///
+ /// \returns \li 0 if successful
+ /// \li 1 otherwise
+ virtual int apply(const clang::tooling::CompilationDatabase &Database,
const std::vector<std::string> &SourcePaths) = 0;
/// \brief Query if changes were made during the last call to apply().
@@ -207,15 +204,6 @@ protected:
/// created with.
const TransformOptions &Options() { return GlobalOptions; }
- /// \brief Affords a subclass to provide file contents overrides before
- /// applying frontend actions.
- ///
- /// It is an error not to call this function before calling ClangTool::run()
- /// with the factory provided by createActionFactory().
- void setOverrides(const FileOverrides &Overrides) {
- this->Overrides = &Overrides;
- }
-
/// \brief Subclasses must call this function to create a
/// FrontendActionFactory to pass to ClangTool.
///
@@ -227,7 +215,6 @@ protected:
private:
const std::string Name;
const TransformOptions &GlobalOptions;
- const FileOverrides *Overrides;
TUReplacementsMap Replacements;
std::string CurrentSource;
TimingVec Timings;
OpenPOWER on IntegriCloud