[clang] [APINotes] Diagnose invalid Where.Parameters selectors (PR #209408)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 08:14:34 PDT 2026
================
@@ -0,0 +1,113 @@
+//===--- SemaAPINotesInternal.h - API Notes Sema Internals ------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LIB_SEMA_SEMAAPINOTESINTERNAL_H
+#define LLVM_CLANG_LIB_SEMA_SEMAAPINOTESINTERNAL_H
+
+#include "clang/APINotes/Types.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include <string>
+#include <utility>
+
+namespace clang {
+class Sema;
+struct APINotesParameterSelectorCandidates;
+namespace api_notes {
+class APINotesReader;
+}
+
+/// One stored exact Where.Parameters selector tracked for diagnostics.
+struct APINotesSelectorDiagnosticEntry {
+ api_notes::APINotesFunctionSelectorKey BroadKey;
----------------
Xazax-hun wrote:
The key and the parameters below is almost the same as `APINotesFunctionSelector`.
I am also wondering if it would be better to have something like `DenseMap<APINotesFunctionSelectorKey, bool>` to track if the keys were used or not. Reporting warnings is relatively rare and is not considered the hot path, so we could potentially lazily reconstruct the spellings on demand instead of storing them if that can simplify the code.
https://github.com/llvm/llvm-project/pull/209408
More information about the cfe-commits
mailing list