Driver: Explicitly warn that -pg isn't supported (even though we
aren't failing the compilation).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68540 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index 9246e7a..402b9aa 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -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'">;
}
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 62a63cb..e26bb9e 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -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