diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-12 20:34:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-12 20:34:05 +0000 |
commit | 77257889f5829144767c8a1d7fc18a929a377b5c (patch) | |
tree | 2e775b373acb240bdb6f323736bc47fa74252e91 /include/clang/Rewrite/Rewriter.h | |
parent | 5c9dc5ac75de8d620311cdc20223998e0293d61f (diff) |
remove ifdefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49587 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Rewrite/Rewriter.h')
-rw-r--r-- | include/clang/Rewrite/Rewriter.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/clang/Rewrite/Rewriter.h b/include/clang/Rewrite/Rewriter.h index e141c79fc3..bb4e16a8e8 100644 --- a/include/clang/Rewrite/Rewriter.h +++ b/include/clang/Rewrite/Rewriter.h @@ -23,8 +23,6 @@ #include <string> #include "clang/Rewrite/DeltaTree.h" -//#define USE_VECTOR 1 - namespace clang { class SourceManager; class Rewriter; @@ -38,13 +36,9 @@ namespace clang { /// locations after the insertion point have to be mapped. class RewriteBuffer { friend class Rewriter; -#ifdef USE_VECTOR /// Deltas - Keep track of all the deltas in the source code due to insertions - /// and deletions. These are kept in sorted order based on the FileLoc. - std::vector<SourceDelta> Deltas; -#else + /// and deletions. DeltaTree Deltas; -#endif /// Buffer - This is the actual buffer itself. Note that using a vector or /// string is a horribly inefficient way to do this, we should use a rope @@ -69,12 +63,16 @@ private: // Methods only usable by Rewriter. /// RewriteBuffer. If AfterInserts is true and if the OrigOffset indicates a /// position where text is inserted, the location returned will be after any /// inserted text at the position. - unsigned getMappedOffset(unsigned OrigOffset, bool AfterInserts = false)const; - + unsigned getMappedOffset(unsigned OrigOffset, + bool AfterInserts = false) const{ + return Deltas.getDeltaAt(OrigOffset+AfterInserts)+OrigOffset; + } /// AddDelta - When a change is made that shifts around the text buffer, this /// method is used to record that info. - void AddDelta(unsigned OrigOffset, int Change); + void AddDelta(unsigned OrigOffset, int Change) { + return Deltas.AddDelta(OrigOffset, Change); + } /// RemoveText - Remove the specified text. void RemoveText(unsigned OrigOffset, unsigned Size); |