refactor: Add no-ASAN macro for Throw statements (#6373)

Throwing exceptions from code sometime confuses ASAN, as it cannot keep track of stack frames. This change therefore adds a macro to skip instrumentation around the `Throw` function.
This commit is contained in:
Pratik Mankawde
2026-03-17 13:10:32 +00:00
committed by GitHub
parent eff344faf9
commit 5ae97fa8ae
4 changed files with 31 additions and 4 deletions

View File

@@ -258,7 +258,7 @@ Number::Guard::doRoundUp(
}
bringIntoRange(negative, mantissa, exponent, minMantissa);
if (exponent > maxExponent)
throw std::overflow_error(location);
Throw<std::overflow_error>(std::string(location));
}
template <UnsignedMantissa T>
@@ -298,7 +298,7 @@ Number::Guard::doRound(rep& drops, std::string location)
// or "(maxRep + 1) / 10", neither of which will round up when
// converting to rep, though the latter might overflow _before_
// rounding.
throw std::overflow_error(location); // LCOV_EXCL_LINE
Throw<std::overflow_error>(std::string(location)); // LCOV_EXCL_LINE
}
++drops;
}