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 @@ -224,19 +224,19 @@ /// Adds a list of components to the operation state. MLIR_CAPI_EXPORTED void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, - MlirType *results); + MlirType const *results); MLIR_CAPI_EXPORTED void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, - MlirValue *operands); + MlirValue const *operands); MLIR_CAPI_EXPORTED void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, - MlirRegion *regions); + MlirRegion const *regions); MLIR_CAPI_EXPORTED void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n, - MlirBlock *successors); + MlirBlock const *successors); MLIR_CAPI_EXPORTED void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, - MlirNamedAttribute *attributes); + MlirNamedAttribute const *attributes); //===----------------------------------------------------------------------===// // Op Printing flags API. @@ -425,7 +425,7 @@ /** 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 *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/include/mlir-c/StandardAttributes.h b/mlir/include/mlir-c/StandardAttributes.h --- a/mlir/include/mlir-c/StandardAttributes.h +++ b/mlir/include/mlir-c/StandardAttributes.h @@ -47,7 +47,7 @@ * context. */ MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, - MlirAttribute *elements); + MlirAttribute const *elements); /// Returns the number of elements stored in the given array attribute. MLIR_CAPI_EXPORTED intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr); @@ -66,7 +66,7 @@ /** Creates a dictionary attribute containing the given list of elements in the * provided context. */ MLIR_CAPI_EXPORTED MlirAttribute mlirDictionaryAttrGet( - MlirContext ctx, intptr_t numElements, MlirNamedAttribute *elements); + MlirContext ctx, intptr_t numElements, MlirNamedAttribute const *elements); /// Returns the number of attributes contained in a dictionary attribute. MLIR_CAPI_EXPORTED intptr_t @@ -207,7 +207,7 @@ * null-terminated and its length must be specified. */ MLIR_CAPI_EXPORTED MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, intptr_t length, const char *symbol, - intptr_t numReferences, MlirAttribute *references); + intptr_t numReferences, MlirAttribute const *references); /** Returns the string reference to the root referenced symbol. The data remains * live as long as the context in which the attribute lives. */ diff --git a/mlir/include/mlir-c/StandardTypes.h b/mlir/include/mlir-c/StandardTypes.h --- a/mlir/include/mlir-c/StandardTypes.h +++ b/mlir/include/mlir-c/StandardTypes.h @@ -225,7 +225,7 @@ MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank, int64_t *shape, intptr_t numMaps, - MlirAttribute *affineMaps, + MlirAttribute const *affineMaps, unsigned memorySpace); /** Creates a MemRef type with the given rank, shape, memory space and element @@ -277,7 +277,7 @@ * type is owned by the context. */ MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, - MlirType *elements); + MlirType const *elements); /// Returns the number of types contained in a tuple. MLIR_CAPI_EXPORTED intptr_t mlirTupleTypeGetNumTypes(MlirType type); @@ -295,9 +295,9 @@ /// Creates a function type, mapping a list of input types to result types. MLIR_CAPI_EXPORTED MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs, - MlirType *inputs, + MlirType const *inputs, intptr_t numResults, - MlirType *results); + MlirType const *results); /// Returns the number of input types. MLIR_CAPI_EXPORTED intptr_t mlirFunctionTypeGetNumInputs(MlirType type); 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 @@ -188,24 +188,24 @@ state->sizeName += n; void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, - MlirType *results) { + MlirType const *results) { APPEND_ELEMS(MlirType, nResults, results); } void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, - MlirValue *operands) { + MlirValue const *operands) { APPEND_ELEMS(MlirValue, nOperands, operands); } void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, - MlirRegion *regions) { + MlirRegion const *regions) { APPEND_ELEMS(MlirRegion, nRegions, regions); } void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n, - MlirBlock *successors) { + MlirBlock const *successors) { APPEND_ELEMS(MlirBlock, nSuccessors, successors); } void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, - MlirNamedAttribute *attributes) { + MlirNamedAttribute const *attributes) { APPEND_ELEMS(MlirNamedAttribute, nAttributes, attributes); } @@ -390,7 +390,7 @@ // Block API. //===----------------------------------------------------------------------===// -MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args) { +MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType const *args) { Block *b = new Block; for (intptr_t i = 0; i < nArgs; ++i) b->addArgument(unwrap(args[i])); diff --git a/mlir/lib/CAPI/IR/StandardAttributes.cpp b/mlir/lib/CAPI/IR/StandardAttributes.cpp --- a/mlir/lib/CAPI/IR/StandardAttributes.cpp +++ b/mlir/lib/CAPI/IR/StandardAttributes.cpp @@ -40,7 +40,7 @@ } MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, - MlirAttribute *elements) { + MlirAttribute const *elements) { SmallVector attrs; return wrap(ArrayAttr::get( unwrapList(static_cast(numElements), elements, attrs), @@ -64,7 +64,7 @@ } MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, - MlirNamedAttribute *elements) { + MlirNamedAttribute const *elements) { SmallVector attributes; attributes.reserve(numElements); for (intptr_t i = 0; i < numElements; ++i) @@ -207,7 +207,7 @@ MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, intptr_t length, const char *symbol, intptr_t numReferences, - MlirAttribute *references) { + MlirAttribute const *references) { SmallVector refs; refs.reserve(numReferences); for (intptr_t i = 0; i < numReferences; ++i) @@ -324,7 +324,7 @@ MlirAttribute mlirDenseElementsAttrGet(MlirType shapedType, intptr_t numElements, - MlirAttribute *elements) { + MlirAttribute const *elements) { SmallVector attributes; return wrap( DenseElementsAttr::get(unwrap(shapedType).cast(), @@ -423,7 +423,7 @@ MlirAttribute mlirDenseElementsAttrStringGet(MlirType shapedType, intptr_t numElements, - intptr_t *strLengths, + intptr_t const *strLengths, const char **strs) { SmallVector values; values.reserve(numElements); diff --git a/mlir/lib/CAPI/IR/StandardTypes.cpp b/mlir/lib/CAPI/IR/StandardTypes.cpp --- a/mlir/lib/CAPI/IR/StandardTypes.cpp +++ b/mlir/lib/CAPI/IR/StandardTypes.cpp @@ -221,7 +221,7 @@ int mlirTypeIsAMemRef(MlirType type) { return unwrap(type).isa(); } MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank, int64_t *shape, - intptr_t numMaps, MlirAffineMap *affineMaps, + intptr_t numMaps, MlirAffineMap const *affineMaps, unsigned memorySpace) { SmallVector maps; (void)unwrapList(numMaps, affineMaps, maps); @@ -285,7 +285,7 @@ int mlirTypeIsATuple(MlirType type) { return unwrap(type).isa(); } MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, - MlirType *elements) { + MlirType const *elements) { SmallVector types; ArrayRef typeRef = unwrapList(numElements, elements, types); return wrap(TupleType::get(typeRef, unwrap(ctx))); @@ -308,8 +308,8 @@ } MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs, - MlirType *inputs, intptr_t numResults, - MlirType *results) { + MlirType const *inputs, intptr_t numResults, + MlirType const *results) { SmallVector inputsList; SmallVector resultsList; (void)unwrapList(numInputs, inputs, inputsList);