[clang] Control analysis-based diagnostics with #pragma (PR #136323)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 09:55:37 PDT 2025


================
@@ -1202,6 +1202,30 @@ Clang also allows you to push and pop the current warning state. This is
 particularly useful when writing a header file that will be compiled by
 other people, because you don't know what warning flags they build with.
 
+Note that the following diagnostic groups, which are ones based on analyzing
----------------
erichkeane wrote:

Ah, no my suggestion is "see the push(actually the enable), set the state on the function".  "See the pop, do nothing other than change the per-line state".  The state is "was this EVER enabled in this function", not "IS this enabled now".

Then at end of function, you check "was ever enabled" kinda thing, then do the analysis.  THEN only emit the warnings that were actually enabled based on effective-line.

https://github.com/llvm/llvm-project/pull/136323


More information about the cfe-commits mailing list