[cfe-commits] r48532 - /cfe/trunk/include/clang/Rewrite/Rewriter.h

Ted Kremenek kremenek at apple.com
Tue Mar 18 22:06:49 PDT 2008


Author: kremenek
Date: Wed Mar 19 00:06:49 2008
New Revision: 48532

URL: http://llvm.org/viewvc/llvm-project?rev=48532&view=rev
Log:
Added InsertStrXXX/InsertCStrXXX methods to the Rewriter to provide a simpler
interface to the rewriter when clients have NULL terminated strings or std::string.

Modified:
    cfe/trunk/include/clang/Rewrite/Rewriter.h

Modified: cfe/trunk/include/clang/Rewrite/Rewriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Rewriter.h?rev=48532&r1=48531&r2=48532&view=diff

==============================================================================
--- cfe/trunk/include/clang/Rewrite/Rewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/Rewriter.h Wed Mar 19 00:06:49 2008
@@ -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 @@
   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);





More information about the cfe-commits mailing list