[llvm-branch-commits] [clang] release/20.x: [clang] Expose -f(no-)strict-overflow as a clang-cl option (#126512) (PR #126518)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 10 06:09:11 PST 2025
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/126518
Backport 71adb054024a1e9bd5ed4566beda74dea65362cd
Requested by: @nico
>From 0ac833ec8514898444c6b510a2ac58ed129d03b9 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Mon, 10 Feb 2025 09:00:31 -0500
Subject: [PATCH] [clang] Expose -f(no-)strict-overflow as a clang-cl option
(#126512)
Also move the -fno-strict-overflow option definition next to the
-fstrict-overflow one while here.
Also add test coverage for f(no-)wrapv-pointer being a clang-cl option.
(cherry picked from commit 71adb054024a1e9bd5ed4566beda74dea65362cd)
---
clang/include/clang/Driver/Options.td | 6 +++---
clang/test/Driver/cl-options.c | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index a2b47b943ef90dd..02e5c4cbb4bff90 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3505,8 +3505,6 @@ def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>;
def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">, Group<f_Group>;
def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
-def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>,
- Visibility<[ClangOption, FlangOption]>;
defm init_global_zero : BoolOptionWithoutMarshalling<"f", "init-global-zero",
PosFlag<SetTrue, [], [FlangOption, FC1Option],
"Zero initialize globals without default initialization (default)">,
@@ -4023,7 +4021,9 @@ defm strict_vtable_pointers : BoolFOption<"strict-vtable-pointers",
" overwriting polymorphic C++ objects">,
NegFlag<SetFalse>>;
def fstrict_overflow : Flag<["-"], "fstrict-overflow">, Group<f_Group>,
- Visibility<[ClangOption, FlangOption]>;
+ Visibility<[ClangOption, CLOption, FlangOption]>;
+def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>,
+ Visibility<[ClangOption, CLOption, FlangOption]>;
def fpointer_tbaa : Flag<["-"], "fpointer-tbaa">, Group<f_Group>;
def fdriver_only : Flag<["-"], "fdriver-only">, Flags<[NoXarchOption]>,
Visibility<[ClangOption, CLOption, DXCOption]>,
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 29a0fcbc17ac603..9f9ca1bf1a8fdc4 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -738,9 +738,13 @@
// RUN: -fno-modules-search-all \
// RUN: -fimplicit-modules \
// RUN: -fno-implicit-modules \
+// RUN: -fstrict-overflow \
+// RUN: -fno-strict-overflow \
// RUN: -ftrivial-auto-var-init=zero \
// RUN: -fwrapv \
// RUN: -fno-wrapv \
+// RUN: -fwrapv-pointer \
+// RUN: -fno-wrapv-pointer \
// RUN: --version \
// RUN: -Werror /Zs -- %s 2>&1
More information about the llvm-branch-commits
mailing list