llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.24k stars 11.66k forks source link

[clang-tidy] Support more macros for bypassing bugprone-unchecked-optional-access #62548

Open hg-zt opened 1 year ago

hg-zt commented 1 year ago

REQUIRE from doctest is currently not supported

TEST_CASE("foo")
{
    REQUIRE(opt.has_value());
    use(*opt); // will warn "Unchecked access to optional value"
}

It would be better if it could be configured

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-tidy

rafaelrojasmiliani commented 9 months ago

I have the same issue. When using doctest, REQUIRE is used often to check if an optional has a value. I think the same would happen with google test EXPECT.