[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 09:10:15 PDT 2025


================
@@ -107,15 +107,28 @@ CXString createCXString(CXStringBuf *buf) {
   return Str;
 }
 
-CXStringSet *createSet(const std::vector<std::string> &Strings) {
+template <typename StringTy, bool Copy>
+static CXStringSet *createSetImpl(ArrayRef<StringTy> Strings) {
----------------
jansvoboda11 wrote:

Nit: If you switched the order of template parameters, the compiler would be able to deduce `StringTy` at the call site and clients wouldn't need to pass it explicitly as a template argument. The downside is that the call in `createSet()` would need to do `ArrayRef(Strings)` explicitly - without it it'd be one implicit conversion too many. Not saying this approach is better than what you currently have, just something to consider.

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


More information about the cfe-commits mailing list