Files
clang-p2996/mlir/lib/CAPI/IR/Support.cpp
Alex Zinenko 30d61893fb [mlir] provide C API and Python bindings for symbol tables
Symbol tables are a largely useful top-level IR construct, for example, they
make it easy to access functions in a module by name instead of traversing the
list of module's operations to find the corresponding function.

Depends On D112886

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D112821
2021-11-02 14:22:58 +01:00

22 lines
745 B
C++

//===- Support.cpp - Helpers for C interface to MLIR API ------------------===//
//
// 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-c/Support.h"
#include "llvm/ADT/StringRef.h"
#include <cstring>
MlirStringRef mlirStringRefCreateFromCString(const char *str) {
return mlirStringRefCreate(str, strlen(str));
}
bool mlirStringRefEqual(MlirStringRef string, MlirStringRef other) {
return llvm::StringRef(string.data, string.length) ==
llvm::StringRef(other.data, other.length);
}