]> granicus.if.org Git - clang/commitdiff
Expose InsertText, fixing an oversight.
authorChris Lattner <sabre@nondot.org>
Fri, 2 Nov 2007 17:26:47 +0000 (17:26 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 2 Nov 2007 17:26:47 +0000 (17:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43643 91177308-0d34-0410-b5e6-96231b3b80d8

Rewrite/Rewriter.cpp

index 894450863e97f569323cfded09571ea9a946163f..a624fcc2c1d572a6ced782a991049479faedba58 100644 (file)
@@ -201,6 +201,16 @@ RewriteBuffer &Rewriter::getEditBuffer(unsigned FileID) {
   return I->second;
 }
 
+/// InsertText - Insert the specified string at the specified location in the
+/// original buffer.  This method is only valid on rewritable source
+/// locations.
+void Rewriter::InsertText(SourceLocation Loc,
+                          const char *StrData, unsigned StrLen) {
+  unsigned FileID;
+  unsigned StartOffs = getLocationOffsetAndFileID(Loc, FileID);
+  getEditBuffer(FileID).InsertText(StartOffs, StrData, StrLen);
+}
+
 /// RemoveText - Remove the specified text region.  This method is only valid
 /// on a rewritable source location.
 void Rewriter::RemoveText(SourceLocation Start, unsigned Length) {