[cfe-commits] r129918 - in /cfe/trunk: include/clang/Basic/DiagnosticDriverKinds.td lib/Driver/ToolChains.cpp
Daniel Dunbar
daniel at zuster.org
Thu Apr 21 10:32:21 PDT 2011
Author: ddunbar
Date: Thu Apr 21 12:32:21 2011
New Revision: 129918
URL: http://llvm.org/viewvc/llvm-project?rev=129918&view=rev
Log:
Driver: Improve -Xarch argument diagnostics a bit.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/lib/Driver/ToolChains.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=129918&r1=129917&r2=129918&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Thu Apr 21 12:32:21 2011
@@ -39,8 +39,12 @@
"invalid Darwin version number: %0">;
def err_drv_missing_argument : Error<
"argument to '%0' is missing (expected %1 %plural{1:value|:values}1)">;
-def err_drv_invalid_Xarch_argument : Error<
- "invalid Xarch argument: '%0'">;
+def err_drv_invalid_Xarch_argument_unknown : Error<
+ "invalid Xarch argument: '%0', option is unrecognized">;
+def err_drv_invalid_Xarch_argument_with_args : Error<
+ "invalid Xarch argument: '%0', options requiring arguments are unsupported">;
+def err_drv_invalid_Xarch_argument_isdriver : Error<
+ "invalid Xarch argument: '%0', cannot change driver behavior inside Xarch argument">;
def err_drv_argument_only_allowed_with : Error<
"invalid argument '%0' only allowed with '%1'">;
def err_drv_argument_not_allowed_with : Error<
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=129918&r1=129917&r2=129918&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Apr 21 12:32:21 2011
@@ -555,9 +555,16 @@
// driver behavior; that isn't going to work in our model. We
// use isDriverOption() as an approximation, although things
// like -O4 are going to slip through.
- if (!XarchArg || Index > Prev + 1 ||
- XarchArg->getOption().isDriverOption()) {
- getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument)
+ if (!XarchArg) {
+ getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument_unknown)
+ << A->getAsString(Args);
+ continue;
+ } else if (Index > Prev + 1) {
+ getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument_with_args)
+ << A->getAsString(Args);
+ continue;
+ } else if (XarchArg->getOption().isDriverOption()) {
+ getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument_isdriver)
<< A->getAsString(Args);
continue;
}
More information about the cfe-commits
mailing list