1 //===- Operation.cpp ------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/Tools/PDLL/ODS/Operation.h"
10 #include "mlir/Support/IndentedOstream.h"
11 #include "llvm/Support/raw_ostream.h"
12 
13 using namespace mlir;
14 using namespace mlir::pdll::ods;
15 
16 //===----------------------------------------------------------------------===//
17 // Operation
18 //===----------------------------------------------------------------------===//
19 
20 Operation::Operation(StringRef name, StringRef summary, StringRef desc,
21                      llvm::SMLoc loc)
22     : name(name.str()), summary(summary.str()),
23       location(loc, llvm::SMLoc::getFromPointer(loc.getPointer() + 1)) {
24   llvm::raw_string_ostream descOS(description);
25   raw_indented_ostream(descOS).printReindented(desc.rtrim(" \t"));
26 }
27