summaryrefslogtreecommitdiffstats
path: root/clang/lib/Edit/Commit.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-10-01 21:16:29 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-10-01 21:16:29 +0000
commit8f5225b3a7a793f3189f7725290e8ddaa4caee8b (patch)
tree8fb061df13a6813660e9243420185a7990a0d06c /clang/lib/Edit/Commit.cpp
parent79b887f3e3a0aac193b9aa6f86a92b028d9edcd0 (diff)
downloadbcm5719-llvm-8f5225b3a7a793f3189f7725290e8ddaa4caee8b.tar.gz
bcm5719-llvm-8f5225b3a7a793f3189f7725290e8ddaa4caee8b.zip
ObjectiveC migrator: When doing migration, migrator must suggest
migration of headers which have become system headers by user having put the .system_framework in the sdk directory. // rdar://15066802 llvm-svn: 191796
Diffstat (limited to 'clang/lib/Edit/Commit.cpp')
-rw-r--r--clang/lib/Edit/Commit.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Edit/Commit.cpp b/clang/lib/Edit/Commit.cpp
index 9c08cc28ac9..706c732dba4 100644
--- a/clang/lib/Edit/Commit.cpp
+++ b/clang/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) {
@@ -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<FileID, unsigned> 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()))
OpenPOWER on IntegriCloud