Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/TableGen/Type.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | Optional<StringRef> TypeConstraint::getBuilderCall() const { | ||||
return TypeSwitch<llvm::Init *, Optional<StringRef>>(builderCall->getValue()) | return TypeSwitch<llvm::Init *, Optional<StringRef>>(builderCall->getValue()) | ||||
.Case<llvm::StringInit>([&](auto *init) { | .Case<llvm::StringInit>([&](auto *init) { | ||||
StringRef value = init->getValue(); | StringRef value = init->getValue(); | ||||
return value.empty() ? Optional<StringRef>() : value; | return value.empty() ? Optional<StringRef>() : value; | ||||
}) | }) | ||||
.Default([](auto *) { return llvm::None; }); | .Default([](auto *) { return llvm::None; }); | ||||
} | } | ||||
// Return the C++ class name for this type (which may just be ::mlir::Type). | |||||
StringRef TypeConstraint::getCPPClassName() const { | |||||
return def->getValueAsString("cppClassName"); | |||||
} | |||||
Type::Type(const llvm::Record *record) : TypeConstraint(record) {} | Type::Type(const llvm::Record *record) : TypeConstraint(record) {} | ||||
StringRef Type::getTypeDescription() const { | StringRef Type::getTypeDescription() const { | ||||
return def->getValueAsString("typeDescription"); | return def->getValueAsString("typeDescription"); | ||||
} | } | ||||
Dialect Type::getDialect() const { | Dialect Type::getDialect() const { | ||||
return Dialect(def->getValueAsDef("dialect")); | return Dialect(def->getValueAsDef("dialect")); | ||||
} | } |