Skip to content

Commit cd93216

Browse files
aeubankststellar
authored andcommitted
Revert "[Driver] Support multi /guard: options"
This reverts commit 3b6f7e4. See comments on D150645. (cherry picked from commit 3d7903f)
1 parent 8c6c56d commit cd93216

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7782,7 +7782,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
77827782
if (Args.hasArg(options::OPT__SLASH_kernel))
77837783
CmdArgs.push_back("-fms-kernel");
77847784

7785-
for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) {
7785+
if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) {
77867786
StringRef GuardArgs = A->getValue();
77877787
// The only valid options are "cf", "cf,nochecks", "cf-", "ehcont" and
77887788
// "ehcont-".

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
227227
Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link);
228228

229229
// Control Flow Guard checks
230-
for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) {
230+
if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) {
231231
StringRef GuardArgs = A->getValue();
232232
if (GuardArgs.equals_insensitive("cf") ||
233233
GuardArgs.equals_insensitive("cf,nochecks")) {

clang/test/Driver/cl-options.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,6 @@
647647
// RUN: %clang_cl /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=EHCONTGUARD %s
648648
// EHCONTGUARD: -ehcontguard
649649

650-
// RUN: %clang_cl /guard:cf /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=BOTHGUARD %s
651-
// BOTHGUARD: -cfguard
652-
// BOTHGUARD-SAME: -ehcontguard
653-
654650
// RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
655651
// CFGUARDINVALID: invalid value 'foo' in '/guard:'
656652

0 commit comments

Comments
 (0)