[MLIR] Expose LocationAttrs in the C API
authorAndrew Young <youngar17@gmail.com>
Wed, 25 Jan 2023 07:13:20 +0000 (23:13 -0800)
committerAndrew Young <youngar17@gmail.com>
Wed, 25 Jan 2023 07:15:00 +0000 (23:15 -0800)
commit7bfdac0e6dd8d9d9a2f8546dedea5d7ffcb5317e
treef549ccb55a27c5e9fde7f2161f6a1490ed991f68
parent494734b06d62b54fdcbd982f96274dede572ba07
[MLIR] Expose LocationAttrs in the C API

This patch adds three functions to the C API:
- mlirAttributeIsALocation: returns true if the attribute is a LocationAttr,
  false otherwise.
- mlirLocationGetAttribute: returns the underlying LocationAttr of a Location.
- mlirLocationFromAttribute: gets a Location from a LocationAttr.

Reviewed By: mikeurbach, Mogball

Differential Revision: https://reviews.llvm.org/D142182
mlir/include/mlir-c/BuiltinAttributes.h
mlir/include/mlir-c/IR.h
mlir/lib/CAPI/IR/BuiltinAttributes.cpp
mlir/lib/CAPI/IR/IR.cpp
mlir/test/CAPI/ir.c