forked from OSchip/llvm-project
Improve fatal error message when an Attribute or Type wasn't initialized by a dialect (NFC)
The existing message hints that the dialect may not be loaded, but there is also the possibility that the dialect was loaded and the initialize() method didn't include the Type/Attribute.
This commit is contained in:
parent
49562d3dfe
commit
d0d991cd23
|
@ -179,10 +179,11 @@ public:
|
|||
#ifndef NDEBUG
|
||||
if (!ctx->getAttributeUniquer().isParametricStorageInitialized(
|
||||
T::getTypeID()))
|
||||
llvm::report_fatal_error(llvm::Twine("can't create Attribute '") +
|
||||
llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: "
|
||||
"the dialect was likely not loaded.");
|
||||
llvm::report_fatal_error(
|
||||
llvm::Twine("can't create Attribute '") + llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: the dialect was likely "
|
||||
"not loaded, or the attribute wasn't added with addAttributes<...>() "
|
||||
"in the Dialect::initialize() method.");
|
||||
#endif
|
||||
return ctx->getAttributeUniquer().get<typename T::ImplType>(
|
||||
[ctx](AttributeStorage *storage) {
|
||||
|
@ -198,10 +199,11 @@ public:
|
|||
#ifndef NDEBUG
|
||||
if (!ctx->getAttributeUniquer().isSingletonStorageInitialized(
|
||||
T::getTypeID()))
|
||||
llvm::report_fatal_error(llvm::Twine("can't create Attribute '") +
|
||||
llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: "
|
||||
"the dialect was likely not loaded.");
|
||||
llvm::report_fatal_error(
|
||||
llvm::Twine("can't create Attribute '") + llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: the dialect was likely "
|
||||
"not loaded, or the attribute wasn't added with addAttributes<...>() "
|
||||
"in the Dialect::initialize() method.");
|
||||
#endif
|
||||
return ctx->getAttributeUniquer().get<typename T::ImplType>(T::getTypeID());
|
||||
}
|
||||
|
|
|
@ -170,10 +170,11 @@ struct TypeUniquer {
|
|||
get(MLIRContext *ctx, Args &&...args) {
|
||||
#ifndef NDEBUG
|
||||
if (!ctx->getTypeUniquer().isParametricStorageInitialized(T::getTypeID()))
|
||||
llvm::report_fatal_error(llvm::Twine("can't create type '") +
|
||||
llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: "
|
||||
"the dialect was likely not loaded.");
|
||||
llvm::report_fatal_error(
|
||||
llvm::Twine("can't create type '") + llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: the dialect was likely "
|
||||
"not loaded, or the type wasn't added with addTypes<...>() "
|
||||
"in the Dialect::initialize() method.");
|
||||
#endif
|
||||
return ctx->getTypeUniquer().get<typename T::ImplType>(
|
||||
[&](TypeStorage *storage) {
|
||||
|
@ -188,10 +189,11 @@ struct TypeUniquer {
|
|||
get(MLIRContext *ctx) {
|
||||
#ifndef NDEBUG
|
||||
if (!ctx->getTypeUniquer().isSingletonStorageInitialized(T::getTypeID()))
|
||||
llvm::report_fatal_error(llvm::Twine("can't create type '") +
|
||||
llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: "
|
||||
"the dialect was likely not loaded.");
|
||||
llvm::report_fatal_error(
|
||||
llvm::Twine("can't create type '") + llvm::getTypeName<T>() +
|
||||
"' because storage uniquer isn't initialized: the dialect was likely "
|
||||
"not loaded, or the type wasn't added with addTypes<...>() "
|
||||
"in the Dialect::initialize() method.");
|
||||
#endif
|
||||
return ctx->getTypeUniquer().get<typename T::ImplType>(T::getTypeID());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue