[Mlir-commits] [mlir] [MLIR][Python] Remove partial LLVM APIs in python bindings (3/n) (PR #178984)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Feb 2 13:49:08 PST 2026


================
@@ -190,15 +192,16 @@ PyGlobals::lookupDialectClass(const std::string &dialectNamespace) {
 }
 
 std::optional<nb::object>
-PyGlobals::lookupOperationClass(llvm::StringRef operationName) {
+PyGlobals::lookupOperationClass(std::string_view operationName) {
   // Make sure dialect module is loaded.
-  auto split = operationName.split('.');
-  llvm::StringRef dialectNamespace = split.first;
+  size_t splitPos = operationName.find('.');
+  std::string_view dialectNamespace = operationName.substr(0, splitPos);
   if (!loadDialectModule(dialectNamespace))
     return std::nullopt;
 
   nb::ft_lock_guard lock(mutex);
-  auto foundIt = operationClassMap.find(operationName);
+  std::string operationNameStr(operationName);
+  auto foundIt = operationClassMap.find(operationNameStr);
----------------
RattataKing wrote:

yes, only in c++20, it can be avoided when Hash and KeyEqual are transparent

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


More information about the Mlir-commits mailing list