This is an incremental version of the patch, against 16.0.4, which includes an earlier version of the patch. From 3b0fad683523315e0fcd14039326fc0ce5eb350b Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Thu, 18 May 2023 12:38:12 +0800 Subject: [PATCH] Reland "[Driver] Support multi /guard: options" Fixes unexpected warning. Differential Revision: https://reviews.llvm.org/D150645 --- clang/lib/Driver/ToolChains/Clang.cpp | 1 + clang/test/Driver/cl-options.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 238507e06335..77554aa2c462 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -7801,6 +7801,7 @@ 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/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index d96b887b7d48..326bc1162714 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -647,9 +647,12 @@ // 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 +// 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:' -- 2.40.0.1.gc689dad23e