[clang-tools-extra] [clang-tidy][NFC] Enable `bugprone-unchecked-optional-access` in `clang-tidy` config and fix warnings (PR #170004)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 09:36:35 PST 2025
================
@@ -96,6 +96,8 @@ void TimeSubtractionCheck::registerMatchers(MatchFinder *Finder) {
const std::string TimeInverse = (llvm::Twine("ToUnix") + ScaleName).str();
std::optional<DurationScale> Scale = getScaleForTimeInverse(TimeInverse);
assert(Scale && "Unknown scale encountered");
+ if (!Scale)
+ continue;
----------------
vbvictor wrote:
Can we then remove first `assert` if we still check via `if` later? (but preserve comment)
https://github.com/llvm/llvm-project/pull/170004
More information about the cfe-commits
mailing list