[cfe-commits] r68540 - in /cfe/trunk: include/clang/Basic/DiagnosticDriverKinds.td lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Tue Apr 7 12:18:24 PDT 2009


Author: ddunbar
Date: Tue Apr  7 14:18:24 2009
New Revision: 68540

URL: http://llvm.org/viewvc/llvm-project?rev=68540&view=rev
Log:
Driver: Explicitly warn that -pg isn't supported (even though we
aren't failing the compilation).

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=68540&r1=68539&r2=68540&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Apr  7 14:18:24 2009
@@ -54,5 +54,7 @@
   "not using the clang compiler for C++ inputs">;
 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'">;
 
 }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68540&r1=68539&r2=68540&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Apr  7 14:18:24 2009
@@ -37,6 +37,7 @@
                          const InputInfoList &Inputs,
                          const ArgList &Args,
                          const char *LinkingOutput) const {
+  const Driver &D = getToolChain().getHost().getDriver();
   ArgStringList CmdArgs;
 
   assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
@@ -277,11 +278,9 @@
 
     Arg *Unsupported;
     if ((Unsupported = Args.getLastArg(options::OPT_MG)) ||
-        (Unsupported = Args.getLastArg(options::OPT_MQ))) {
-      const Driver &D = getToolChain().getHost().getDriver();
+        (Unsupported = Args.getLastArg(options::OPT_MQ)))
       D.Diag(clang::diag::err_drv_unsupported_opt) 
         << Unsupported->getOption().getName();
-    }
   }
 
   Args.AddAllArgs(CmdArgs, options::OPT_v);
@@ -415,6 +414,19 @@
     Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc").c_str());
   Dest.addCommand(new Command(Exec, CmdArgs));
 
+  // Explicitly warn that these options are unsupported, even though
+  // we are allowing compilation to continue.
+  // FIXME: Use iterator.
+  for (ArgList::const_iterator 
+         it = Args.begin(), ie = Args.end(); it != ie; ++it) {
+    const Arg *A = *it;
+    if (A->getOption().matches(options::OPT_pg)) {
+      A->claim();
+      D.Diag(clang::diag::warn_drv_clang_unsupported) 
+        << A->getAsString(Args);
+    }
+  }
+
   // Claim some arguments which clang supports automatically.
 
   // -fpch-preprocess is used with gcc to add a special marker in the





More information about the cfe-commits mailing list