NFC: Fix return indentation in generated op definitions.

PiperOrigin-RevId: 270070670
This commit is contained in:
Prakalp Srivastava 2019-09-19 10:23:32 -07:00 committed by TensorFlower Gardener
parent d290833308
commit 34391f7659

View File

@ -665,8 +665,8 @@ static void generateNamedOperandGetters(const Operator &op, Class &opClass,
if (numVariadicOperands == 0) { if (numVariadicOperands == 0) {
// We still need to match the return type, which is a range. // We still need to match the return type, which is a range.
m.body() << "return {std::next(" << rangeBeginCall << ", index), std::next(" m.body() << " return {std::next(" << rangeBeginCall
<< rangeBeginCall << ", index + 1)};"; << ", index), std::next(" << rangeBeginCall << ", index + 1)};";
} else { } else {
// Because the op can have arbitrarily interleaved variadic and non-variadic // Because the op can have arbitrarily interleaved variadic and non-variadic
// operands, we need to embed a list in the "sink" getter method for // operands, we need to embed a list in the "sink" getter method for
@ -693,10 +693,10 @@ static void generateNamedOperandGetters(const Operator &op, Class &opClass,
if (operand.isVariadic()) { if (operand.isVariadic()) {
auto &m = opClass.newMethod(rangeType, operand.name); auto &m = opClass.newMethod(rangeType, operand.name);
m.body() << "return getODSOperands(" << i << ");"; m.body() << " return getODSOperands(" << i << ");";
} else { } else {
auto &m = opClass.newMethod("Value *", operand.name); auto &m = opClass.newMethod("Value *", operand.name);
m.body() << "return *getODSOperands(" << i << ").begin();"; m.body() << " return *getODSOperands(" << i << ").begin();";
} }
} }
} }
@ -727,7 +727,7 @@ void OpEmitter::genNamedResultGetters() {
"unsigned index"); "unsigned index");
if (numVariadicResults == 0) { if (numVariadicResults == 0) {
m.body() << "return {std::next(getOperation()->result_begin(), index), " m.body() << " return {std::next(getOperation()->result_begin(), index), "
"std::next(getOperation()->result_begin(), index + 1)};"; "std::next(getOperation()->result_begin(), index + 1)};";
} else { } else {
llvm::SmallVector<StringRef, 4> isVariadic; llvm::SmallVector<StringRef, 4> isVariadic;
@ -749,10 +749,10 @@ void OpEmitter::genNamedResultGetters() {
if (result.isVariadic()) { if (result.isVariadic()) {
auto &m = opClass.newMethod("Operation::result_range", result.name); auto &m = opClass.newMethod("Operation::result_range", result.name);
m.body() << "return getODSResults(" << i << ");"; m.body() << " return getODSResults(" << i << ");";
} else { } else {
auto &m = opClass.newMethod("Value *", result.name); auto &m = opClass.newMethod("Value *", result.name);
m.body() << "return *getODSResults(" << i << ").begin();"; m.body() << " return *getODSResults(" << i << ").begin();";
} }
} }
} }
@ -763,7 +763,7 @@ void OpEmitter::genNamedRegionGetters() {
const auto &region = op.getRegion(i); const auto &region = op.getRegion(i);
if (!region.name.empty()) { if (!region.name.empty()) {
auto &m = opClass.newMethod("Region &", region.name); auto &m = opClass.newMethod("Region &", region.name);
m.body() << formatv("return this->getOperation()->getRegion({0});", i); m.body() << formatv(" return this->getOperation()->getRegion({0});", i);
} }
} }
} }