summaryrefslogtreecommitdiffstats
path: root/include/clang/Edit/Commit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Edit/Commit.h')
-rw-r--r--include/clang/Edit/Commit.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/clang/Edit/Commit.h b/include/clang/Edit/Commit.h
index 48e3d59..626b1dd 100644
--- a/include/clang/Edit/Commit.h
+++ b/include/clang/Edit/Commit.h
@@ -13,6 +13,7 @@
#include "clang/Edit/FileOffset.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Allocator.h"
namespace clang {
class LangOptions;
@@ -48,16 +49,19 @@ private:
const LangOptions &LangOpts;
const PPConditionalDirectiveRecord *PPRec;
EditedSource *Editor;
-
+
+ const bool ForceCommitInSystemHeader;
bool IsCommitable;
SmallVector<Edit, 8> CachedEdits;
+
+ llvm::BumpPtrAllocator StrAlloc;
public:
explicit Commit(EditedSource &Editor);
Commit(const SourceManager &SM, const LangOptions &LangOpts,
const PPConditionalDirectiveRecord *PPRec = 0)
: SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), Editor(0),
- IsCommitable(true) { }
+ ForceCommitInSystemHeader(true), IsCommitable(true) { }
bool isCommitable() const { return IsCommitable; }
@@ -103,7 +107,7 @@ public:
CharSourceRange::getTokenRange(TokenInnerRange));
}
- typedef SmallVector<Edit, 8>::const_iterator edit_iterator;
+ typedef SmallVectorImpl<Edit>::const_iterator edit_iterator;
edit_iterator edit_begin() const { return CachedEdits.begin(); }
edit_iterator edit_end() const { return CachedEdits.end(); }
@@ -131,6 +135,12 @@ private:
SourceLocation *MacroBegin = 0) const;
bool isAtEndOfMacroExpansion(SourceLocation loc,
SourceLocation *MacroEnd = 0) const;
+
+ StringRef copyString(StringRef str) {
+ char *buf = StrAlloc.Allocate<char>(str.size());
+ std::memcpy(buf, str.data(), str.size());
+ return StringRef(buf, str.size());
+ }
};
}
OpenPOWER on IntegriCloud