1 //===- Support.cpp - Helpers for C interface to MLIR API ------------------===//
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-c/Support.h"
10 #include "llvm/ADT/StringRef.h"
11 
12 #include <cstring>
13 
14 MlirStringRef mlirStringRefCreateFromCString(const char *str) {
15   return mlirStringRefCreate(str, strlen(str));
16 }
17 
18 bool mlirStringRefEqual(MlirStringRef string, MlirStringRef other) {
19   return llvm::StringRef(string.data, string.length) ==
20          llvm::StringRef(other.data, other.length);
21 }
22