From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- lib/Edit/Commit.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/Edit/Commit.cpp') diff --git a/lib/Edit/Commit.cpp b/lib/Edit/Commit.cpp index 0b4ea3e..706c732 100644 --- a/lib/Edit/Commit.cpp +++ b/lib/Edit/Commit.cpp @@ -38,7 +38,9 @@ CharSourceRange Commit::Edit::getInsertFromRange(SourceManager &SM) const { Commit::Commit(EditedSource &Editor) : SourceMgr(Editor.getSourceManager()), LangOpts(Editor.getLangOpts()), PPRec(Editor.getPPCondDirectiveRecord()), - Editor(&Editor), IsCommitable(true) { } + Editor(&Editor), + ForceCommitInSystemHeader(Editor.getForceCommitInSystemHeader()), + IsCommitable(true) { } bool Commit::insert(SourceLocation loc, StringRef text, bool afterToken, bool beforePreviousInsertions) { @@ -183,7 +185,7 @@ void Commit::addInsert(SourceLocation OrigLoc, FileOffset Offs, StringRef text, data.Kind = Act_Insert; data.OrigLoc = OrigLoc; data.Offset = Offs; - data.Text = text; + data.Text = copyString(text); data.BeforePrev = beforePreviousInsertions; CachedEdits.push_back(data); } @@ -232,7 +234,7 @@ bool Commit::canInsert(SourceLocation loc, FileOffset &offs) { if (!isAtStartOfMacroExpansion(loc, &loc)) return false; - if (SM.isInSystemHeader(loc)) + if (SM.isInSystemHeader(loc) && ForceCommitInSystemHeader) return false; std::pair locInfo = SM.getDecomposedLoc(loc); @@ -263,7 +265,7 @@ bool Commit::canInsertAfterToken(SourceLocation loc, FileOffset &offs, if (!isAtEndOfMacroExpansion(loc, &loc)) return false; - if (SM.isInSystemHeader(loc)) + if (SM.isInSystemHeader(loc) && ForceCommitInSystemHeader) return false; loc = Lexer::getLocForEndOfToken(loc, 0, SourceMgr, LangOpts); @@ -301,8 +303,8 @@ bool Commit::canRemoveRange(CharSourceRange range, if (range.getBegin().isMacroID() || range.getEnd().isMacroID()) return false; - if (SM.isInSystemHeader(range.getBegin()) || - SM.isInSystemHeader(range.getEnd())) + if ((SM.isInSystemHeader(range.getBegin()) || + SM.isInSystemHeader(range.getEnd())) && ForceCommitInSystemHeader) return false; if (PPRec && PPRec->rangeIntersectsConditionalDirective(range.getAsRange())) -- cgit v1.1