================
@@ -159,6 +161,14 @@ class APINotesReader {
   VersionedInfo<CXXMethodInfo> lookupCXXMethod(ContextID CtxID,
                                                llvm::StringRef Name);
 
+  /// Look for information regarding the given C++ method with an optional
+  /// parameter selector. Passing std::nullopt uses the name-only key, an empty
+  /// parameter list uses an exact zero-parameter key, and a non-empty list 
uses
+  /// an exact ordered parameter key.
+  VersionedInfo<CXXMethodInfo>
+  lookupCXXMethod(ContextID CtxID, llvm::StringRef Name,
+                  std::optional<llvm::ArrayRef<llvm::StringRef>> Parameters);
----------------
Xazax-hun wrote:

Oh, I see that the original overload is implemented by passing a null to this 
one. I think we could potentially do this by making this one private and have a 
public one that takes a non-optional ArrayRef and implement both by calling 
this one.

The main design principle I am advocating for is to have only one way to do 
something using the public APIs.

E.g., now `lookupCXXMethod(ctx, name, std::nullopt)` and `lookupCXXMethod(ctx, 
name)` are both doing the same. It is cleaner when there are no overlaps like 
that. 

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

Reply via email to