1//===- CppGenUtilities.h - MLIR cpp gen utilities ---------------*- C++ -*-===//
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// This file defines common utilities for generating cpp files from tablegen
10// structures.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_TOOLS_MLIRTBLGEN_CPPGENUTILITIES_H_
15#define MLIR_TOOLS_MLIRTBLGEN_CPPGENUTILITIES_H_
16
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Support/raw_ostream.h"
20
21namespace mlir {
22namespace tblgen {
23
24// Emit the summary and description as a C++ comment. If `terminateComment` is
25// true, terminates the comment with a `\n`.
26void emitSummaryAndDescComments(llvm::raw_ostream &os, llvm::StringRef summary,
27 llvm::StringRef description,
28 bool terminateComment = true);
29
30// Emit an `#include` directive for every header in `headers`, sorted
31// and without duplicates. Headers are emitted verbatim; a header that could
32// break out of the directive is a fatal error.
33void emitIncludes(llvm::raw_ostream &os,
34 llvm::ArrayRef<llvm::StringRef> headers);
35} // namespace tblgen
36} // namespace mlir
37
38#endif // MLIR_TOOLS_MLIRTBLGEN_CPPGENUTILITIES_H_
39