[clang] [sanitizer] Add plumbing for -fsanitize-add-pseudo-functions and partly replace '-mllvm -array-bounds-pseudofn' (PR #138577)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Mon May 5 15:39:24 PDT 2025


================
@@ -2533,6 +2533,31 @@ def fno_sanitize_merge_handlers : Flag<["-"], "fno-sanitize-merge">, Group<f_cla
                         Alias<fno_sanitize_merge_handlers_EQ>, AliasArgs<["all"]>,
                         Visibility<[ClangOption, CLOption]>,
                         HelpText<"Do not allow compiler to merge handlers for any sanitizers">;
+def fsanitize_add_pseudo_functions_EQ
+    : CommaJoined<["-"], "fsanitize-add-pseudo-functions=">,
+      Group<f_clang_Group>,
+      HelpText<"Add pseudo-functions to checks for specified sanitizers, if "
+               "supported.">;
+def fno_sanitize_add_pseudo_functions_EQ
+    : CommaJoined<["-"], "fno-sanitize-add-pseudo-functions=">,
+      Group<f_clang_Group>,
+      HelpText<"Do not allow compiler to add pseudo-functions to checks for "
+               "specified sanitizers">;
+def fsanitize_add_pseudo_functions
----------------
delcypher wrote:

Nit. I don't think "add pseudo functions" is very helpful name. It's not clear at all what this means. Glancing at the implementation it looks like this is adding fake inline frames in the debug info with the name `__ubsan_check_array_bounds`. If the intention is to always use debug info as the implementation and to it will always annotate instrumentation a name like `-fsanitize-annotate-debug-info` might be more descriptive.

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


More information about the cfe-commits mailing list