[clang] [clang] Make documentation warnings faster with --warning-suppression-mappings= (PR #244714)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 02:35:36 PST 2026


================
@@ -2806,10 +2806,29 @@ void Sema::clearDocumentationDiagsCache() {
   DocDiagsExactComputed = 0;
 }
 
+bool Sema::areDocumentationDiagsSourceLocationDependent() {
+  // Documentation diagnostics are not location-dependent, except if a
+  // (location-dependent) warning suppression mapping is active.
+  if (!DocDiagsInSuppressionMapping) {
----------------
zmodem wrote:

nit: I find it more natural to put the in-cache path first (that will save an indentation level later too):
```
if (DocDiagsInSuppressionMapping)
  return *DocDiagsInSuppressionMapping;
...
return DocDiagsInSuppressionMapping = ...;
```
but maybe that's just a personal preference.

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


More information about the cfe-commits mailing list