[clang] bc9fda0 - Revert "Reland "[Driver] Support multi /guard: options""
Phoebe Wang via cfe-commits
cfe-commits at lists.llvm.org
Sun May 21 07:43:26 PDT 2023
Author: Phoebe Wang
Date: 2023-05-21T22:39:37+08:00
New Revision: bc9fda01ad1341519694bbf1e1b738298e3395f3
URL: https://github.com/llvm/llvm-project/commit/bc9fda01ad1341519694bbf1e1b738298e3395f3
DIFF: https://github.com/llvm/llvm-project/commit/bc9fda01ad1341519694bbf1e1b738298e3395f3.diff
LOG: Revert "Reland "[Driver] Support multi /guard: options""
This reverts commit a4f366dcd85c440a611bbc82f1d24c2d9a735251.
Found a problem during backport it to 16.x branch.
https://github.com/llvm/llvm-project-release-prs/actions/runs/5036930270/jobs/9033427592?pr=451
The reason is `-implicit-check-not='warning'` may conflict with option
name, e.g., `-treat-scalable-fixed-error-as-warning`
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/cl-options.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 809440b196fd8..a55fe1cedb2ef 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7876,7 +7876,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
if (Args.hasArg(options::OPT__SLASH_kernel))
CmdArgs.push_back("-fms-kernel");
- for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) {
+ if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) {
StringRef GuardArgs = A->getValue();
// The only valid options are "cf", "cf,nochecks", "cf-", "ehcont" and
// "ehcont-".
@@ -7895,7 +7895,6 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
} else {
D.Diag(diag::err_drv_invalid_value) << A->getSpelling() << GuardArgs;
}
- A->claim();
}
}
diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index d803ddad504c6..b23d0aa2f1b83 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -227,7 +227,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link);
// Control Flow Guard checks
- for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) {
+ if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) {
StringRef GuardArgs = A->getValue();
if (GuardArgs.equals_insensitive("cf") ||
GuardArgs.equals_insensitive("cf,nochecks")) {
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 781298bea7b94..12d7023bd61b1 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -647,13 +647,6 @@
// RUN: %clang_cl /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=EHCONTGUARD %s
// EHCONTGUARD: -ehcontguard
-// RUN: %clang_cl /guard:cf /guard:ehcont -Wall -Wno-msvc-not-found -### -- %s 2>&1 | \
-// RUN: FileCheck -check-prefix=BOTHGUARD %s --implicit-check-not=warning
-// BOTHGUARD: -cfguard
-// BOTHGUARD-SAME: -ehcontguard
-// BOTHGUARD: -guard:cf
-// BOTHGUARD-SAME: -guard:ehcont
-
// RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
// CFGUARDINVALID: invalid value 'foo' in '/guard:'
More information about the cfe-commits
mailing list