diff --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h --- a/mlir/include/mlir-c/IR.h +++ b/mlir/include/mlir-c/IR.h @@ -148,6 +148,11 @@ unsigned line, unsigned col); +/** Creates an File/Line/Column location owned by the given context using an + * MlirStringRef for the filename. */ +MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileStringRefLineColGet( + MlirContext context, MlirStringRef filename, unsigned line, unsigned col); + /// Creates a location with unknown position owned by the given context. MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet(MlirContext context); @@ -225,9 +230,9 @@ MLIR_CAPI_EXPORTED void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, MlirType const *results); -MLIR_CAPI_EXPORTED void mlirOperationStateAddOperands(MlirOperationState *state, - intptr_t n, - MlirValue const *operands); +MLIR_CAPI_EXPORTED void +mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, + MlirValue const *operands); MLIR_CAPI_EXPORTED void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, MlirRegion const *regions); @@ -425,7 +430,8 @@ /** Creates a new empty block with the given argument types and transfers * ownership to the caller. */ -MLIR_CAPI_EXPORTED MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType const *args); +MLIR_CAPI_EXPORTED MlirBlock mlirBlockCreate(intptr_t nArgs, + MlirType const *args); /// Takes a block owned by the caller and destroys it. MLIR_CAPI_EXPORTED void mlirBlockDestroy(MlirBlock block); diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp --- a/mlir/lib/CAPI/IR/IR.cpp +++ b/mlir/lib/CAPI/IR/IR.cpp @@ -114,6 +114,13 @@ return wrap(FileLineColLoc::get(filename, line, col, unwrap(context))); } +MlirLocation mlirLocationFileStringRefLineColGet(MlirContext context, + MlirStringRef filename, + unsigned line, unsigned col) { + return wrap( + FileLineColLoc::get(unwrap(filename), line, col, unwrap(context))); +} + MlirLocation mlirLocationUnknownGet(MlirContext context) { return wrap(UnknownLoc::get(unwrap(context))); }