Silencing Diagnostics - RedpointGames/llvm-project GitHub Wiki
You can change the severity of diagnostics or silence diagnostics using #pragma directives.
Silencing rule diagnostics
To silence rule diagnostics, use the fully qualified name of the rule (both the namespace and the rule name).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wnamespace/rule"
#pragma clang diagnostic ignored "-Wnamespace/rule2"
#pragma clang diagnostic ignored "-Wnamespace/rule3"
#endif
// ...
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
You can use ignored on rules that are configured for Error severity in the .clang-rules configuration files, but you can't reduce an Error severity down to a warning with a #pragma directive due to limitations inside Clang's diagnostic system.
Silencing include-what-you-use diagnostics
Refer to Include-What-You-Use Analyser on how to silence warnings from include-what-you-use analysis.