[clang][driver] Rename DriverOption as NoXarchOption (NFC)

As discussed in [1], ClangFlags::DriverOption is currently only used to
mark options that should not be forwarded to other tools via `-Xarch`
options. This patch renames this flag accordingly and updates the
corresponding driver diagnostic.

A comment in ToolChain::TranslateXarchArgs is also updated to reflect
the change. The original comment referred to isDriverOption(), which is
no longer available.

[1] http://lists.llvm.org/pipermail/cfe-dev/2020-October/066953.html

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D89799
This commit is contained in:
Andrzej Warzynski 2020-10-30 15:57:42 +00:00
parent 4dfe014a12
commit e5699b8ff1
5 changed files with 193 additions and 192 deletions

View File

@ -121,8 +121,6 @@ def err_drv_missing_argument : Error<
"argument to '%0' is missing (expected %1 value%s1)">;
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_Xopenmp_target_missing_triple : Error<
"cannot deduce implicit triple value for -Xopenmp-target, specify triple using -Xopenmp-target=<triple>">;
def err_drv_invalid_Xopenmp_target_with_args : Error<

View File

@ -314,7 +314,7 @@ public:
const llvm::opt::OptTable &getOpts() const { return getDriverOptTable(); }
const DiagnosticsEngine &getDiags() const { return Diags; }
DiagnosticsEngine &getDiags() const { return Diags; }
llvm::vfs::FileSystem &getVFS() const { return *VFS; }

View File

@ -24,7 +24,7 @@ namespace options {
/// Flags specifically for clang options. Must not overlap with
/// llvm::opt::DriverFlag.
enum ClangFlags {
DriverOption = (1 << 4),
NoXarchOption = (1 << 4),
LinkerInput = (1 << 5),
NoArgumentUnused = (1 << 6),
Unsupported = (1 << 7),

File diff suppressed because it is too large Load Diff

View File

@ -1223,15 +1223,18 @@ void ToolChain::TranslateXarchArgs(
//
// We also want to disallow any options which would alter the
// 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.
// use options::NoXarchOption to control this.
if (!XarchArg || Index > Prev + 1) {
getDriver().Diag(diag::err_drv_invalid_Xarch_argument_with_args)
<< A->getAsString(Args);
return;
} else if (XarchArg->getOption().hasFlag(options::DriverOption)) {
getDriver().Diag(diag::err_drv_invalid_Xarch_argument_isdriver)
<< A->getAsString(Args);
} else if (XarchArg->getOption().hasFlag(options::NoXarchOption)) {
auto &Diags = getDriver().getDiags();
unsigned DiagID =
Diags.getCustomDiagID(DiagnosticsEngine::Error,
"invalid Xarch argument: '%0', not all driver "
"options can be forwared via Xarch argument");
Diags.Report(DiagID) << A->getAsString(Args);
return;
}
XarchArg->setBaseArg(A);