1//===- RequestCWrappers.cpp - Annotate funcs with wrap attributes ---------===//
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/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
10#include "mlir/Dialect/Func/IR/FuncOps.h"
11#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
12#include "mlir/Pass/Pass.h"
13
14namespace mlir {
15namespace LLVM {
16#define GEN_PASS_DEF_LLVMREQUESTCWRAPPERS
17#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
18} // namespace LLVM
19} // namespace mlir
20
21using namespace mlir;
22
23namespace {
24class RequestCWrappersPass
25 : public LLVM::impl::LLVMRequestCWrappersBase<RequestCWrappersPass> {
26public:
27 void runOnOperation() override {
28 getOperation()->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(),
29 UnitAttr::get(&getContext()));
30 }
31};
32} // namespace
33
34std::unique_ptr<Pass> mlir::LLVM::createRequestCWrappersPass() {
35 return std::make_unique<RequestCWrappersPass>();
36}
37

source code of mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp