forked from OSchip/llvm-project
Allow Dialects to be initialized via nullptr.
This allows Dialect to follow the MLIR style of nullable objects, and in fact is expected by `Dialect::operator bool() const` which already tests whether `def == nullptr`. This just wasn't a reachable situation, because the constructor was dereferencing the pointer unconditionally. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D86807
This commit is contained in:
parent
a39423084c
commit
d867be5de3
|
@ -16,6 +16,8 @@
|
||||||
using namespace mlir;
|
using namespace mlir;
|
||||||
using namespace mlir::tblgen;
|
using namespace mlir::tblgen;
|
||||||
Dialect::Dialect(const llvm::Record *def) : def(def) {
|
Dialect::Dialect(const llvm::Record *def) : def(def) {
|
||||||
|
if (def == nullptr)
|
||||||
|
return;
|
||||||
for (StringRef dialect : def->getValueAsListOfStrings("dependentDialects"))
|
for (StringRef dialect : def->getValueAsListOfStrings("dependentDialects"))
|
||||||
dependentDialects.push_back(dialect);
|
dependentDialects.push_back(dialect);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue