[llvm] [NFC] [hwasan] factor out some opt handling (PR #84414)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 16:25:35 PDT 2024


================
@@ -296,10 +297,8 @@ class HWAddressSanitizer {
   HWAddressSanitizer(Module &M, bool CompileKernel, bool Recover,
                      const StackSafetyGlobalInfo *SSI)
       : M(M), SSI(SSI) {
-    this->Recover = ClRecover.getNumOccurrences() > 0 ? ClRecover : Recover;
-    this->CompileKernel = ClEnableKhwasan.getNumOccurrences() > 0
-                              ? ClEnableKhwasan
-                              : CompileKernel;
+    this->Recover = optOr(ClRecover, Recover);
+    this->CompileKernel = optOr(ClEnableKhwasan, CompileKernel);
     this->Rng =
         RandomSkipRate.getNumOccurrences() ? M.createRNG("hwasan") : nullptr;
----------------
vitalybuka wrote:

what is wrong with RandomSkipRate

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


More information about the llvm-commits mailing list