Move FixItAtLocations into FrontendOptions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87046 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/Options.cpp b/tools/clang-cc/Options.cpp
index 9469abf..7181b7c 100644
--- a/tools/clang-cc/Options.cpp
+++ b/tools/clang-cc/Options.cpp
@@ -313,6 +313,10 @@
 static llvm::cl::opt<bool>
 FixItAll("fixit", llvm::cl::desc("Apply fix-it advice to the input source"));
 
+static llvm::cl::list<ParsedSourceLocation>
+FixItAtLocations("fixit-at", llvm::cl::value_desc("source-location"),
+   llvm::cl::desc("Perform Fix-It modifications at the given source location"));
+
 static llvm::cl::opt<std::string>
 OutputFile("o",
  llvm::cl::value_desc("path"),
@@ -757,6 +761,7 @@
   Opts.DisableFree = DisableFree;
   Opts.EmptyInputOnly = EmptyInputOnly;
   Opts.FixItAll = FixItAll;
+  Opts.FixItLocations = FixItAtLocations;
   Opts.RelocatablePCH = RelocatablePCH;
   Opts.ShowStats = Stats;
   Opts.ShowTimers = TimeReport;
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 2d04ab1..1b9578c 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -211,14 +211,6 @@
              clEnumValEnd));
 
 //===----------------------------------------------------------------------===//
-// Frontend Options
-//===----------------------------------------------------------------------===//
-
-static llvm::cl::list<ParsedSourceLocation>
-FixItAtLocations("fixit-at", llvm::cl::value_desc("source-location"),
-   llvm::cl::desc("Perform Fix-It modifications at the given source location"));
-
-//===----------------------------------------------------------------------===//
 // Language Options
 //===----------------------------------------------------------------------===//
 
@@ -445,20 +437,21 @@
 /// AddFixItLocations - Add any individual user specified "fix-it" locations,
 /// and return true on success (if any were added).
 static bool AddFixItLocations(FixItRewriter *FixItRewrite,
-                              FileManager &FileMgr) {
+                              FileManager &FileMgr,
+                              const std::vector<ParsedSourceLocation> &Locs) {
   bool AddedFixItLocation = false;
 
-  for (unsigned i = 0, e = FixItAtLocations.size(); i != e; ++i) {
-    if (const FileEntry *File = FileMgr.getFile(FixItAtLocations[i].FileName)) {
+  for (unsigned i = 0, e = Locs.size(); i != e; ++i) {
+    if (const FileEntry *File = FileMgr.getFile(Locs[i].FileName)) {
       RequestedSourceLocation Requested;
       Requested.File = File;
-      Requested.Line = FixItAtLocations[i].Line;
-      Requested.Column = FixItAtLocations[i].Column;
+      Requested.Line = Locs[i].Line;
+      Requested.Column = Locs[i].Column;
       FixItRewrite->addFixItLocation(Requested);
       AddedFixItLocation = true;
     } else {
       llvm::errs() << "FIX-IT could not find file \""
-                   << FixItAtLocations[i].FileName << "\"\n";
+                   << Locs[i].FileName << "\"\n";
     }
   }
 
@@ -517,7 +510,7 @@
     }
 
     // Fix-its can change semantics, disallow with any IRgen action.
-    if (FEOpts.FixItAll || !FixItAtLocations.empty()) {
+    if (FEOpts.FixItAll || !FEOpts.FixItLocations.empty()) {
       PP.getDiagnostics().Report(diag::err_fe_no_fixit_and_codegen);
       return 0;
     }
@@ -655,12 +648,13 @@
   }
 
   // Check if we want a fix-it rewriter.
-  if (FEOpts.FixItAll || !FixItAtLocations.empty()) {
+  if (FEOpts.FixItAll || !FEOpts.FixItLocations.empty()) {
     FixItRewrite = new FixItRewriter(PP.getDiagnostics(),
                                      PP.getSourceManager(),
                                      PP.getLangOptions());
-    if (!FixItAtLocations.empty() &&
-        !AddFixItLocations(FixItRewrite, PP.getFileManager())) {
+    if (!FEOpts.FixItLocations.empty() &&
+        !AddFixItLocations(FixItRewrite, PP.getFileManager(),
+                           FEOpts.FixItLocations)) {
       // All of the fix-it locations were bad. Don't fix anything.
       delete FixItRewrite;
       FixItRewrite = 0;