llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang-tidy: bugprone-unchecked-optional-access docs refer to a google-internal document

Open mineo opened this issue 3 years ago • 4 comments

https://github.com/llvm/llvm-project/blob/e50a508b5c3d3d814340e8818c757295d27c48dd/clang-tools-extra/docs/clang-tidy/checks/bugprone/unchecked-optional-access.rst says "See go/optional-style-recommendations for more information on that topic". I think "go/" is some google-internal thing. I think having access to that document (or a summary of it) would be great to have, especially to understand why std::optional::value is not considered safe access, even if it's required to throw an exception if the optional does not contain a value.

mineo avatar Feb 09 '23 13:02 mineo

@llvm/issue-subscribers-clang-tidy

llvmbot avatar Feb 09 '23 15:02 llvmbot

@ymand Would it be possible for you to provide a link or an explanation for the above? Pinging you as git blame shows you as the committer.

dc03 avatar Feb 10 '23 11:02 dc03

even if it's required to throw an exception

I would guess the main reason lies somewhere around the fact that -fno-exceptions disables this requirement.

whisperity avatar Feb 10 '23 15:02 whisperity

Thanks for catching this. I'll send a patch shortly.

ymand avatar Feb 10 '23 16:02 ymand