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

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 13:42:18 PDT 2023


================
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning<
   "as the %select{aliasee|resolver}2">,
   InGroup<IgnoredAttributes>;
 
+let CategoryName = "Bounds Safety Issue" in {
+def err_bounds_safety_lang_not_supported : Error<
+  "bounds safety is only supported for C">;
+def warn_bounds_safety_asm_ignored : Warning<
+  "'-fbounds-safety' is ignored for assembly">,
----------------
rapidsna wrote:


> Conventionally the language compatibility checking and other checking is performed in Driver, not in Frontend.. If you move the language check to Driver, the diagnostic will be natural since clang integrated assembler uses `ClangAs` instead of `Clang`.

@MaskRay It seems both `Clang` and `ClangAs` are invoked for the `clang` command with an assembly input (i.e., `ClangAs` is invoked after `Clang`) so it seems to me that most options are already `claimed` in `Clang` and so `warning: argument unused during compilation` doesn't seem to fire for `clang` in most cases including `-fsanitize=address`.

Also, we need to have the input language (`InputKind`) to report the right diagnostics so the frontend still seems like the right place to handle this.

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


More information about the cfe-commits mailing list