Author: mfehr Date: 2021-01-21T00:29:58Z New Revision: 8a7ff7301a6ce50f2adf52959c04f37a00c5a631
URL: https://github.com/llvm/llvm-project/commit/8a7ff7301a6ce50f2adf52959c04f37a00c5a631 DIFF: https://github.com/llvm/llvm-project/commit/8a7ff7301a6ce50f2adf52959c04f37a00c5a631.diff LOG: [mlir] Make MLIRContext::getOrLoadDialect(StringRef, TypeID, ...) public Having this function in a public scope is helpful to register dialects that are defined at runtime, and thus that need a runtime-defined TypeID. Also, a similar function in DialectRegistry, insert(TypeID, StringRef, ...), has a public scope. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D95091 Added: Modified: mlir/include/mlir/IR/MLIRContext.h Removed: ################################################################################ diff --git a/mlir/include/mlir/IR/MLIRContext.h b/mlir/include/mlir/IR/MLIRContext.h index e460064a889f..4751f00a36df 100644 --- a/mlir/include/mlir/IR/MLIRContext.h +++ b/mlir/include/mlir/IR/MLIRContext.h @@ -156,17 +156,19 @@ class MLIRContext { void enterMultiThreadedExecution(); void exitMultiThreadedExecution(); -private: - const std::unique_ptr<MLIRContextImpl> impl; - /// Get a dialect for the provided namespace and TypeID: abort the program if /// a dialect exist for this namespace with diff erent TypeID. If a dialect has /// not been loaded for this namespace/TypeID yet, use the provided ctor to /// create one on the fly and load it. Returns a pointer to the dialect owned /// by the context. + /// The use of this method is in general discouraged in favor of + /// 'getOrLoadDialect<DialectClass>()'. Dialect *getOrLoadDialect(StringRef dialectNamespace, TypeID dialectID, function_ref<std::unique_ptr<Dialect>()> ctor); +private: + const std::unique_ptr<MLIRContextImpl> impl; + MLIRContext(const MLIRContext &) = delete; void operator=(const MLIRContext &) = delete; }; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits