[clang] [Driver][BoundsSafety] Add -fexperimental-bounds-safety flag (PR #70480)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 8 13:38:33 PST 2023
================
@@ -3618,6 +3618,27 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed);
}
+static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine &Diags) {
----------------
delcypher wrote:
There are various different options here.
1. The frontend silently accepts`-fexperimental-bounds-safety` with `-x c++` but doesn't actually enable `fexperimental-bounds-safety`.
2. The frontend accepts`-fexperimental-bounds-safety` with `-x c++` enables `-fexperimental-bounds-safety` and probably crashes because it's not supported.
3. The frontend rejects`-fexperimental-bounds-safety` with `-x c++` with an error.
I don't like (1.) because when writing frontend only tests it is inviting someone to accidentally write a test incorrectly because the frontend would never complain about the invalid configuration.
I don't like (2.) because crashing really isn't good when it could so easily be prevented.
I think we should do (3.) because it has none of the previously mentioned downsides.
https://github.com/llvm/llvm-project/pull/70480
More information about the cfe-commits
mailing list