[clang] [clang] Mark some language options as benign. (PR #131569)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 06:54:07 PDT 2025


https://github.com/matts1 updated https://github.com/llvm/llvm-project/pull/131569

>From f53415b24c0cf9da6ac4e5c563dc46e72c224d2e Mon Sep 17 00:00:00 2001
From: Matt Stark <msta at google.com>
Date: Mon, 10 Mar 2025 12:09:49 +1100
Subject: [PATCH] [clang] Mark some language options as benign.

I'm  fairly certain that the options in this CL are benign, as I don't believe they affect the AST.
* RTTI - shouldn't affect the AST, should only affect codegen
* Trivial var init - also should only affect codegen
* Stack protector - also codegen
* Exceptions - Since exceptions do allow new things in the AST, but I'm pretty sure that they can differ in parent and child safely, I marked it as compatible instead.

I welcome any input from someone more familiar with this than me, as I might be wrong.
---
 clang/docs/ReleaseNotes.rst               | 1 +
 clang/include/clang/Basic/LangOptions.def | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 372a95c80717c..bcd5df2f2edc0 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -295,6 +295,7 @@ Bug Fixes to C++ Support
 - Clang no longer crashes when a coroutine is declared ``[[noreturn]]``. (#GH127327)
 - Clang now uses the parameter location for abbreviated function templates in ``extern "C"``. (#GH46386)
 - Clang now correctly parses ``if constexpr`` expressions in immediate function context. (#GH123524)
+- Clang modules now allow a module and its user to have a larger variety of configurations.
 
 Improvements to C++ diagnostics
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 383440ddbc0ea..db13433d46017 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -399,11 +399,11 @@ BENIGN_LANGOPT(HalfNoSemanticInterposition, 1, 0,
                "Like -fno-semantic-interposition but don't use local aliases")
 ENUM_LANGOPT(StackProtector, StackProtectorMode, 2, SSPOff,
              "stack protector mode")
-ENUM_LANGOPT(TrivialAutoVarInit, TrivialAutoVarInitKind, 2, TrivialAutoVarInitKind::Uninitialized,
+BENIGN_ENUM_LANGOPT(TrivialAutoVarInit, TrivialAutoVarInitKind, 2, TrivialAutoVarInitKind::Uninitialized,
              "trivial automatic variable initialization")
-VALUE_LANGOPT(TrivialAutoVarInitStopAfter, 32, 0,
+BENIGN_VALUE_LANGOPT(TrivialAutoVarInitStopAfter, 32, 0,
              "stop trivial automatic variable initialization after the specified number of instances. Must be greater than 0.")
-VALUE_LANGOPT(TrivialAutoVarInitMaxSize, 32, 0,
+BENIGN_VALUE_LANGOPT(TrivialAutoVarInitMaxSize, 32, 0,
              "stop trivial automatic variable initialization if var size exceeds the specified size (in bytes). Must be greater than 0.")
 ENUM_LANGOPT(SignedOverflowBehavior, SignedOverflowBehaviorTy, 2, SOB_Undefined,
              "signed integer overflow handling")



More information about the cfe-commits mailing list