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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191796 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Edit/Commit.cpp b/lib/Edit/Commit.cpp
index 9c08cc2..706c732 100644
--- a/lib/Edit/Commit.cpp
+++ b/lib/Edit/Commit.cpp
@@ -38,7 +38,9 @@
 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 @@
     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 @@
     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 @@
   
   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()))