[PATCH] D143750: [clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 10 09:40:46 PST 2023
ymandel marked an inline comment as done.
ymandel added inline comments.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/unchecked-optional-access.rst:278
+
+Given that ``value()`` has well-defined program termination behavior, why treat
+it the same as ``operator*()`` which causes undefined behavior (UB)? That is,
----------------
xazax.hun wrote:
> Strictly speaking, `value` on an empty optional will not terminate the program. It will raise an exception that can be handled.
>
> (Of course, at Google, exceptions are banned so termination is right in that context.)
Right! Updated to mention both possibilities. Thx
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143750/new/
https://reviews.llvm.org/D143750
More information about the cfe-commits
mailing list