Don't warn about -funit-at-a-time, and reject -fno-unit-at-a-time.
 - We could just warn about -fno-unit-at-a-time, but in practice people using it
   probably aren't going to get what they want out of clang.

Also, use "clang" specified error for unsupported things instead of driver
unsupported error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72272 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index 8a0616b..327db00 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -43,6 +43,8 @@
   "invalid version number in '%0'">;
 def err_drv_no_linker_llvm_support : Error<
   "'%0': unable to pass LLVM bit-code files to linker">;
+def err_drv_clang_unsupported : Error<
+  "the clang compiler does not support '%0'">;
 
 def warn_drv_input_file_unused : Warning<
   "%0: '%1' input unused when '%2' is present">;
@@ -57,6 +59,6 @@
 def warn_drv_not_using_clang_arch : Warning<
   "not using the clang compiler for the '%0' architecture">;
 def warn_drv_clang_unsupported : Warning<
-  "the clang compiler does not yet support '%0'">;
+  "the clang compiler does not support '%0'">;
 
 }
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def
index 90258ef..2ec2336 100644
--- a/include/clang/Driver/Options.def
+++ b/include/clang/Driver/Options.def
@@ -415,6 +415,7 @@
 OPTION("-fno-show-column", fno_show_column, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-stack-protector", fno_stack_protector, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-strict-aliasing", fno_strict_aliasing, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fno-unit-at-a-time", fno_unit_at_a_time, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-unwind-tables", fno_unwind_tables, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-working-directory", fno_working_directory, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-zero-initialized-in-bss", fno_zero_initialized_in_bss, Flag, f_Group, INVALID, "", 0, 0, 0)
@@ -447,6 +448,7 @@
 OPTION("-ftime-report", ftime_report, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-ftraditional", ftraditional, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-ftrapv", ftrapv, Flag, f_Group, INVALID, "", 0, 0, 0)
+OPTION("-funit-at-a-time", funit_at_a_time, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-funsigned-bitfields", funsigned_bitfields, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-funwind-tables", funwind_tables, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fverbose-asm", fverbose_asm, Flag, f_Group, INVALID, "", 0, 0, 0)
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 91e39dd..fd071df 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -399,7 +399,7 @@
   if ((Unsupported = Args.getLastArg(options::OPT_MG)) ||
       (Unsupported = Args.getLastArg(options::OPT_MQ)) ||
       (Unsupported = Args.getLastArg(options::OPT_iframework)))
-    D.Diag(clang::diag::err_drv_unsupported_opt)
+    D.Diag(clang::diag::err_drv_clang_unsupported)
       << Unsupported->getOption().getName();
 
   Args.AddAllArgs(CmdArgs, options::OPT_v);
@@ -549,6 +549,14 @@
       CmdArgs.push_back("-fdollars-in-identifiers=0");
   }
 
+  // -funit-at-a-time is default, and we don't support -fno-unit-at-a-time for
+  // practical purposes.
+  if (Arg *A = Args.getLastArg(options::OPT_funit_at_a_time, 
+                               options::OPT_fno_unit_at_a_time)) {
+    if (A->getOption().matches(options::OPT_fno_unit_at_a_time))
+      D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
+  }
+  
   Args.AddLastArg(CmdArgs, options::OPT_dM);
   Args.AddLastArg(CmdArgs, options::OPT_dD);