[clang] [llvm] [BoundsChecking] Add parameters to pass (PR #119894)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 08:24:10 PST 2024


================
@@ -1286,6 +1286,33 @@ Expected<RealtimeSanitizerOptions> parseRtSanPassOptions(StringRef Params) {
   return Result;
 }
 
+Expected<BoundsCheckingPass::ReportingMode>
+parseBoundsCheckingOptions(StringRef Params) {
+  BoundsCheckingPass::ReportingMode Mode =
+      BoundsCheckingPass::ReportingMode::Trap;
+  while (!Params.empty()) {
+    StringRef ParamName;
+    std::tie(ParamName, Params) = Params.split(';');
+    if (ParamName == "trap") {
----------------
vitalybuka wrote:

@MaskRay Do have opinion on the following subject.

I need to pass -fsanitize-trap=local-bounds, -fsanitize-recover=local-bounds into this pass.
Looking at driver there are 2 approaches:
1. Put them into LangOptions, and put into constructor https://github.com/llvm/llvm-project/blob/331f3cc94b3c66eebf5ec462a8f1ee0d7704dd26/clang/lib/CodeGen/BackendUtil.cpp#L711
2. -mllvm flags https://github.com/llvm/llvm-project/blob/331f3cc94b3c66eebf5ec462a8f1ee0d7704dd26/clang/lib/Driver/SanitizerArgs.cpp#L1300


To me no.1 looks better, but require these out of sync parse/printPipeline functions.

What is the state of art?



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


More information about the llvm-commits mailing list