aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-19 05:06:49 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-19 05:06:49 +0000
commit329f0f5df1a4b45740312a53b8d01e32a76c91a5 (patch)
tree0ae89e3272638b395c6797eb13df053a512caac7
parentf7768bc7a369dbcd883d400f0e5177756adbcefb (diff)
Added InsertStrXXX/InsertCStrXXX methods to the Rewriter to provide a simpler
interface to the rewriter when clients have NULL terminated strings or std::string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48532 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Rewrite/Rewriter.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/clang/Rewrite/Rewriter.h b/include/clang/Rewrite/Rewriter.h
index 70a863c73d..e8a367d42b 100644
--- a/include/clang/Rewrite/Rewriter.h
+++ b/include/clang/Rewrite/Rewriter.h
@@ -19,6 +19,8 @@
#include "clang/Rewrite/RewriteRope.h"
#include <map>
#include <vector>
+#include <cstring>
+#include <string>
namespace clang {
class SourceManager;
@@ -169,7 +171,26 @@ public:
bool InsertTextBefore(SourceLocation Loc, const char *StrData,
unsigned StrLen) {
return InsertText(Loc, StrData, StrLen, false);
- }
+ }
+
+
+ bool InsertCStrBefore(SourceLocation Loc, const char* Str) {
+ return InsertTextBefore(Loc, Str, strlen(Str));
+ }
+
+
+ bool InsertCStrAfter(SourceLocation Loc, const char* Str) {
+ return InsertTextAfter(Loc, Str, strlen(Str));
+ }
+
+ bool InsertStrBefore(SourceLocation Loc, const std::string& S) {
+ return InsertTextBefore(Loc, S.c_str(), S.size());
+ }
+
+ bool InsertStrAfter(SourceLocation Loc, const std::string& S) {
+ return InsertTextAfter(Loc, S.c_str(), S.size());
+ }
+
/// RemoveText - Remove the specified text region.
bool RemoveText(SourceLocation Start, unsigned Length);