forked from OSchip/llvm-project
Prefix Operator getter methods with "get" to be consistent
PiperOrigin-RevId: 231416230
This commit is contained in:
parent
755538328b
commit
1dfc3ac5ce
|
@ -55,10 +55,10 @@ public:
|
|||
const SmallVectorImpl<StringRef> &getSplitDefName() const;
|
||||
|
||||
// Returns the C++ class name of the op.
|
||||
StringRef cppClassName() const;
|
||||
StringRef getCppClassName() const;
|
||||
|
||||
// Returns the C++ class name of the op with namespace added.
|
||||
std::string qualifiedCppClassName() const;
|
||||
std::string getQualCppClassName() const;
|
||||
|
||||
// Op attribute interators.
|
||||
using attribute_iterator = NamedAttribute *;
|
||||
|
|
|
@ -46,10 +46,10 @@ StringRef tblgen::Operator::getOperationName() const {
|
|||
return def.getValueAsString("opName");
|
||||
}
|
||||
|
||||
StringRef tblgen::Operator::cppClassName() const {
|
||||
StringRef tblgen::Operator::getCppClassName() const {
|
||||
return getSplitDefName().back();
|
||||
}
|
||||
std::string tblgen::Operator::qualifiedCppClassName() const {
|
||||
std::string tblgen::Operator::getQualCppClassName() const {
|
||||
return llvm::join(getSplitDefName(), "::");
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void OpEmitter::emit(const Record &def, raw_ostream &os) {
|
|||
|
||||
emitter.mapOverClassNamespaces(
|
||||
[&os](StringRef ns) { os << "\nnamespace " << ns << "{\n"; });
|
||||
os << formatv("class {0} : public Op<{0}", emitter.op.cppClassName());
|
||||
os << formatv("class {0} : public Op<{0}", emitter.op.getCppClassName());
|
||||
emitter.emitTraits();
|
||||
os << "> {\npublic:\n";
|
||||
|
||||
|
@ -168,7 +168,7 @@ void OpEmitter::emit(const Record &def, raw_ostream &os) {
|
|||
emitter.emitFolders();
|
||||
|
||||
os << "private:\n friend class ::mlir::OperationInst;\n"
|
||||
<< " explicit " << emitter.op.cppClassName()
|
||||
<< " explicit " << emitter.op.getCppClassName()
|
||||
<< "(const OperationInst* state) : Op(state) {}\n};\n";
|
||||
emitter.mapOverClassNamespaces(
|
||||
[&os](StringRef ns) { os << "} // end namespace " << ns << "\n"; });
|
||||
|
@ -529,7 +529,7 @@ static void emitOpList(const std::vector<Record *> &defs, raw_ostream &os) {
|
|||
for (auto &def : defs) {
|
||||
if (!first)
|
||||
os << ",";
|
||||
os << Operator(def).qualifiedCppClassName();
|
||||
os << Operator(def).getQualCppClassName();
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ static void emitOpDoc(const RecordKeeper &recordKeeper, raw_ostream &os) {
|
|||
os << "# Operation definition\n";
|
||||
for (auto *def : defs) {
|
||||
Operator op(def);
|
||||
os << "## " << op.getOperationName() << " (" << op.qualifiedCppClassName()
|
||||
os << "## " << op.getOperationName() << " (" << op.getQualCppClassName()
|
||||
<< ")";
|
||||
|
||||
// Emit summary & description of operator.
|
||||
|
|
|
@ -132,7 +132,7 @@ void PatternEmitter::emitOpMatch(DagNode tree, int depth) {
|
|||
os.indent(indent) << formatv("if (!op{0}) return matchFailure();\n", depth);
|
||||
os.indent(indent) << formatv(
|
||||
"if (!op{0}->isa<{1}>()) return matchFailure();\n", depth,
|
||||
op.qualifiedCppClassName());
|
||||
op.getQualCppClassName());
|
||||
}
|
||||
if (tree.getNumArgs() != op.getNumArgs())
|
||||
PrintFatalError(loc, Twine("mismatch in number of arguments to op '") +
|
||||
|
@ -287,7 +287,7 @@ void PatternEmitter::emitReplaceOpWithNewOp(DagNode resultTree) {
|
|||
|
||||
os << formatv(R"(
|
||||
rewriter.replaceOpWithNewOp<{0}>(op, op->getResult(0)->getType())",
|
||||
resultOp.cppClassName());
|
||||
resultOp.getCppClassName());
|
||||
if (numOpArgs != resultTree.getNumArgs()) {
|
||||
PrintFatalError(loc, Twine("mismatch between arguments of resultant op (") +
|
||||
Twine(numOpArgs) +
|
||||
|
|
Loading…
Reference in New Issue