[llvm-branch-commits] [clang] cd93216 - Revert "[Driver] Support multi /guard: options"

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 30 15:35:21 PDT 2023


Author: Arthur Eubanks
Date: 2023-05-30T13:15:09-07:00
New Revision: cd932165e59573865e7847c18ba68e8f02b7f733

URL: https://github.com/llvm/llvm-project/commit/cd932165e59573865e7847c18ba68e8f02b7f733
DIFF: https://github.com/llvm/llvm-project/commit/cd932165e59573865e7847c18ba68e8f02b7f733.diff

LOG: Revert "[Driver] Support multi /guard: options"

This reverts commit 3b6f7e45a20990fdbc2b43dc08457fc79d53bd39.

See comments on D150645.

(cherry picked from commit 3d7903f1008febc80cb104eedcbcd31d2690839f)

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 238507e063355..ec6860113b7e3 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7782,7 +7782,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-".

diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index b8aa21b7a766d..8ad67ca3e13f2 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 d96b887b7d484..1d588bdfc1b00 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -647,10 +647,6 @@
 // RUN: %clang_cl /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=EHCONTGUARD %s
 // EHCONTGUARD: -ehcontguard
 
-// RUN: %clang_cl /guard:cf /guard:ehcont -### -- %s 2>&1 | FileCheck -check-prefix=BOTHGUARD %s
-// BOTHGUARD: -cfguard
-// BOTHGUARD-SAME: -ehcontguard
-
 // RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
 // CFGUARDINVALID: invalid value 'foo' in '/guard:'
 


        


More information about the llvm-branch-commits mailing list