================
@@ -1072,6 +1073,69 @@ getAPINotesParameterSelectorCandidates(const Sema &S, 
const FunctionDecl *FD) {
   return Candidates;
 }
 
+static api_notes::APINotesFunctionSelectorKey
+getBroadAPINotesSelectorKey(api_notes::APINotesFunctionSelectorKey Key) {
+  Key.ParameterTypeIDs = std::nullopt;
+  return Key;
+}
+
+static APINotesSelectorDiagnosticReaderState &
+getAPINotesSelectorDiagnosticState(Sema &S, api_notes::APINotesReader *Reader) 
{
+  if (!S.APINotesSelectorDiagnostics)
+    S.APINotesSelectorDiagnostics =
+        std::make_unique<APINotesSelectorDiagnosticState>();
+  auto &State = S.APINotesSelectorDiagnostics->Readers[Reader];
+  if (State.Initialized)
+    return State;
+
+  State.Initialized = true;
----------------
j-hui wrote:

This seems unnecessary. If it's already in the `Readers` map, it should already 
be initialized, right?

Can you use something like `try_emplace` instead? That will return a `bool` 
that will tell you whether a new entry was created, means you need perform the 
initialization.

https://github.com/llvm/llvm-project/pull/209408
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to