//
//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_TOOLING_REFACTORING_H
+#define LLVM_CLANG_TOOLING_REFACTORING_H
+
#include "llvm/ADT/StringRef.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Tooling/Tooling.h"
/// \brief Applies the replacement on the Rewriter.
bool apply(Rewriter &Rewrite) const;
+ /// \brief Returns a human readable string representation.
+ std::string toString() const;
+
/// \brief Comparator to be able to use Replacement in std::set for uniquing.
class Less {
public:
} // end namespace tooling
} // end namespace clang
+
+#endif // end namespace LLVM_CLANG_TOOLING_REFACTORING_H
+
return RewriteSucceeded;
}
+std::string Replacement::toString() const {
+ std::string result;
+ llvm::raw_string_ostream stream(result);
+ stream << FilePath << ": " << Offset << ":+" << Length
+ << ":\"" << ReplacementText << "\"";
+ return result;
+}
+
bool Replacement::Less::operator()(const Replacement &R1,
const Replacement &R2) const {
if (R1.FilePath != R2.FilePath) return R1.FilePath < R2.FilePath;