summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-10-23 19:47:36 +0000
committerDaniel Jasper <djasper@google.com>2014-10-23 19:47:36 +0000
commit4475a249e710dcfa35ccace4c6ef5f57250fae11 (patch)
treeee3c617796a96654c8528461fecae9a8a82c69e2 /clang/lib/Rewrite
parent957eae22f45f0fb9f38dc0a657654f61d7d25793 (diff)
downloadbcm5719-llvm-4475a249e710dcfa35ccace4c6ef5f57250fae11.tar.gz
bcm5719-llvm-4475a249e710dcfa35ccace4c6ef5f57250fae11.zip
Remove code duplication and cut dependency from clangRewrite on
clangAST. llvm-svn: 220502
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r--clang/lib/Rewrite/CMakeLists.txt1
-rw-r--r--clang/lib/Rewrite/Rewriter.cpp21
2 files changed, 0 insertions, 22 deletions
diff --git a/clang/lib/Rewrite/CMakeLists.txt b/clang/lib/Rewrite/CMakeLists.txt
index 0c77536012a..16550b1b710 100644
--- a/clang/lib/Rewrite/CMakeLists.txt
+++ b/clang/lib/Rewrite/CMakeLists.txt
@@ -10,7 +10,6 @@ add_clang_library(clangRewrite
TokenRewriter.cpp
LINK_LIBS
- clangAST
clangBasic
clangLex
)
diff --git a/clang/lib/Rewrite/Rewriter.cpp b/clang/lib/Rewrite/Rewriter.cpp
index eab4ccfeadc..c8f4c80b1e6 100644
--- a/clang/lib/Rewrite/Rewriter.cpp
+++ b/clang/lib/Rewrite/Rewriter.cpp
@@ -328,27 +328,6 @@ bool Rewriter::ReplaceText(SourceRange range, SourceRange replacementRange) {
return ReplaceText(start, origLength, MB.substr(newOffs, newLength));
}
-/// ReplaceStmt - This replaces a Stmt/Expr with another, using the pretty
-/// printer to generate the replacement code. This returns true if the input
-/// could not be rewritten, or false if successful.
-bool Rewriter::ReplaceStmt(Stmt *From, Stmt *To) {
- assert(From != nullptr && To != nullptr && "Expected non-null Stmt's");
-
- // Measaure the old text.
- int Size = getRangeSize(From->getSourceRange());
- if (Size == -1)
- return true;
-
- // Get the new text.
- std::string SStr;
- llvm::raw_string_ostream S(SStr);
- To->printPretty(S, nullptr, PrintingPolicy(*LangOpts));
- const std::string &Str = S.str();
-
- ReplaceText(From->getLocStart(), Size, Str);
- return false;
-}
-
std::string Rewriter::ConvertToString(Stmt *From) {
assert(From != nullptr && "Expected non-null Stmt");
std::string SStr;
OpenPOWER on IntegriCloud