Files
clang-p2996/mlir/lib/Tools/PDLL/ODS/Operation.cpp
River Riddle bf352e0b2e [mlir:PDLL] Add better support for providing Constraint/Pattern/Rewrite documentation
This commit enables providing long-form documentation more seamlessly to the LSP
by revamping decl documentation. For ODS imported constructs, we now also import
descriptions and attach them to decls when possible. For PDLL constructs, the LSP will
now try to provide documentation by parsing the comments directly above the decls
location within the source file. This commit also adds a new parser flag
`enableDocumentation` that gates the import and attachment of ODS documentation,
which is unnecessary in the normal build process (i.e. it should only be used/consumed
by tools).

Differential Revision: https://reviews.llvm.org/D124881
2022-06-02 16:31:07 -07:00

27 lines
1.1 KiB
C++

//===- Operation.cpp ------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Tools/PDLL/ODS/Operation.h"
#include "mlir/Support/IndentedOstream.h"
#include "llvm/Support/raw_ostream.h"
using namespace mlir;
using namespace mlir::pdll::ods;
//===----------------------------------------------------------------------===//
// Operation
//===----------------------------------------------------------------------===//
Operation::Operation(StringRef name, StringRef summary, StringRef desc,
StringRef nativeClassName, bool supportsTypeInferrence,
llvm::SMLoc loc)
: name(name.str()), summary(summary.str()), description(desc.str()),
nativeClassName(nativeClassName.str()),
supportsTypeInferrence(supportsTypeInferrence),
location(loc, llvm::SMLoc::getFromPointer(loc.getPointer() + 1)) {}