[clang] [clang-tools-extra] [clang-tidy] Add `IgnoreValueCalls` option to bugprone-unchecked-optional-access (PR #167209)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 10 00:38:26 PST 2025


================
@@ -46,6 +46,13 @@ struct UncheckedOptionalAccessModelOptions {
   /// are confident in this const accessor caching, we shouldn't need the
   /// IgnoreSmartPointerDereference option anymore.
   bool IgnoreSmartPointerDereference = false;
+
+  /// In generating diagnostics, ignore calls to `optional::value()`.
+  ///
+  /// Projects that intentionally use `value()` as a guarded access pattern may
+  /// set this to true to suppress diagnostics for `value()` while continuing to
+  /// diagnose UB-prone operator accesses (`operator*`, `operator->`).
----------------
vbvictor wrote:

I'm not sure whatever this is needed, since it's internal documentation that users would not see anyway.

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


More information about the cfe-commits mailing list