[clang] [APINotes] Diagnose invalid Where.Parameters selectors (PR #209408)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 05:31:16 PDT 2026


================
@@ -1143,6 +1185,23 @@ void Sema::ProcessAPINotes(Decl *D) {
                   return Reader->lookupGlobalFunction(FD->getName(), Parameters,
                                                       APINotesContext);
                 });
+
+          if (ParameterSelectorCandidates &&
+              !Diags.isIgnored(diag::warn_apinotes_message,
----------------
Xazax-hun wrote:

I wonder if this is not correct. The diagnostic state (what diagnostics are ignored) can change throughout the translation unit via pragmas like:
```
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wname"
#include "someHeader"
#pragma clang diagnostic pop
```

We might skip some bookkeeping like `markCandidatesUsed` and spuriously emit some warnings later on.

I wonder if we should always do the bookkeeping and only guard the emission of these warnings at the end of the TU based on the warning state at the end of the TU. 

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


More information about the cfe-commits mailing list