clio
clio copied to clipboard
Make clang-tidy to fail if there is no check after dynamic_cast
Currently there are places (mostly in tests) with code like:
auto ptr = dynamic_cast<Foo*>(mockFoo);
EXPECT_EQ(ptr->bar(), expected_value);
and clang-tidy is fine with it.
We should force clang-tidy to fail on such places to force to check pointer after dynamic_cast
.
Tried to use clang-analyzer-core
and clang-analyzer-cplusplus
(in particular core.NullDereference).
Unfortunately it does not seem to catch the cases we want even with this option disabled as suggested in the above link:
CheckOptions:
core.NullDereference:SuppressAddressSpaces: false