[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 11:01:36 PDT 2023


================
@@ -3618,6 +3618,23 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,
     GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed);
 }
 
+static bool SupportsBoundsSafety(Language Lang) {
+  // Currently, bounds safety is only supported for C. However, it's also
+  // possible to pass assembly files and LLVM IR through Clang, and
+  // those should be trivially supported. This is especially important because
+  // some build systems, like xcbuild and somewhat clumsy Makefiles, will pass
+  // C_FLAGS to Clang while building assembly files.
+  switch (Lang) {
+  case Language::Unknown:
+  case Language::Asm:
----------------
delcypher wrote:

Can we have the compiler emit a warning that `-fbounds-safety-experimental` is ignored when ASM/LLVM IR/Unknown is compiled? I think that's better than silently accepting the flag but the flag does nothing.

https://github.com/llvm/llvm-project/pull/70480


More information about the cfe-commits mailing list