diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | bfef399519ca9b8a4b4c6b563253bad7e0eeffe0 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /include/clang/Edit/Commit.h | |
parent | 6a0372513edbc473b538d2f724efac50405d6fef (diff) |
Diffstat (limited to 'include/clang/Edit/Commit.h')
-rw-r--r-- | include/clang/Edit/Commit.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/clang/Edit/Commit.h b/include/clang/Edit/Commit.h index 48e3d593aa54..626b1dd6305e 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()); + } }; } |