This diff is an attempt to workaround a common problem with clang-tidy deployment.
There are headers that might not be compatible with your project style guide but you
have to use macro from that headers so clang-tidy could report lots of style issues
that you cannot fix or is some cases even annotate with NOLINT. Solution proposed
in this diff is to avoid reporting diagnostics in macro expansion of the macro defined
in headers that doesn't match the desired --header-filter.
Just one real life example of this issue from a very popular gflags library.
This library requires using macro in use code like this:
DEFINE_bool(some_bool_flag, "the default value should go here, not the description", false);
But the macro has outdated version of compiler assert that uses C-style arrays.
Therefore use code becomes incompatible with clang-tidy check modernize-avoid-c-arrays.
Another example of problematic is googletest/googlemock with lots of macro that you cannot avoid.
New feature implemented behind configuration flag for backward compatibility.
This should also check if the Optional has a value