================
@@ -809,6 +810,31 @@ getFunctionSelectorKey(llvm::StringRef Name,
   return Key.str().str();
 }
 
+// YAML conversion has parameter spellings but no AST context. Keep this as a
+// narrow lexical normalization step. Declaration spellings are normalized with
+// QualType in Sema before using the same lexical selector normalization.
+static void normalizeWhereParameterList(
+    llvm::ArrayRef<llvm::StringRef> Parameters,
+    llvm::SmallVectorImpl<std::string> &NormalizedParameters) {
+  NormalizedParameters.clear();
+  NormalizedParameters.reserve(Parameters.size());
+
+  for (llvm::StringRef Parameter : Parameters)
+    NormalizedParameters.push_back(
+        normalizeAPINotesParameterSelector(Parameter));
+}
+
+static llvm::SmallVector<llvm::StringRef, 4>
+getParameterSelectorRefs(llvm::ArrayRef<std::string> Parameters) {
----------------
StoeckOverflow wrote:

I think templating `getFunctionSelectorKey` would remove this helper from the 
duplicate-key path, but not from the writer path. The normalized selector 
spellings are owned as `std::string`s, while `APINotesWriter::addCXXMethod` and 
`addGlobalFunction` currently take `ArrayRef<StringRef>`.

To remove the helper entirely, I would also need to change the writer API or 
add writer overloads for the owning string range. That feels like a broader 
writer API cleanup, so I’d prefer to keep this local adapter here unless you 
think the writer API should be generalized as part of this patch.

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

Reply via email to