[llvm-branch-commits] [mlir] 1e73955 - [mlir] Use more C99 comments in C API header files
Alex Zinenko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 25 10:28:14 PST 2021
Author: Alex Zinenko
Date: 2021-01-25T19:23:06+01:00
New Revision: 1e739552ee96db4b3f2d792976ea849cb6f23650
URL: https://github.com/llvm/llvm-project/commit/1e739552ee96db4b3f2d792976ea849cb6f23650
DIFF: https://github.com/llvm/llvm-project/commit/1e739552ee96db4b3f2d792976ea849cb6f23650.diff
LOG: [mlir] Use more C99 comments in C API header files
These were left over from the original reformatting commit.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D95357
Added:
Modified:
mlir/include/mlir-c/AffineExpr.h
mlir/include/mlir-c/AffineMap.h
mlir/include/mlir-c/BuiltinAttributes.h
mlir/include/mlir-c/BuiltinTypes.h
mlir/include/mlir-c/Diagnostics.h
mlir/include/mlir-c/IR.h
mlir/include/mlir-c/Pass.h
mlir/include/mlir-c/Support.h
Removed:
################################################################################
diff --git a/mlir/include/mlir-c/AffineExpr.h b/mlir/include/mlir-c/AffineExpr.h
index d5c6e7b9f29e..5516f29088e4 100644
--- a/mlir/include/mlir-c/AffineExpr.h
+++ b/mlir/include/mlir-c/AffineExpr.h
@@ -17,17 +17,16 @@ extern "C" {
#endif
//===----------------------------------------------------------------------===//
-/** Opaque type declarations.
- *
- * Types are exposed to C bindings as structs containing opaque pointers. They
- * are not supposed to be inspected from C. This allows the underlying
- * representation to change without affecting the API users. The use of structs
- * instead of typedefs enables some type safety as structs are not implicitly
- * convertible to each other.
- *
- * Instances of these types may or may not own the underlying object. The
- * ownership semantics is defined by how an instance of the type was obtained.
- */
+// Opaque type declarations.
+//
+// Types are exposed to C bindings as structs containing opaque pointers. They
+// are not supposed to be inspected from C. This allows the underlying
+// representation to change without affecting the API users. The use of structs
+// instead of typedefs enables some type safety as structs are not implicitly
+// convertible to each other.
+//
+// Instances of these types may or may not own the underlying object. The
+// ownership semantics is defined by how an instance of the type was obtained.
//===----------------------------------------------------------------------===//
#define DEFINE_C_API_STRUCT(name, storage) \
@@ -54,9 +53,9 @@ inline static bool mlirAffineExprIsNull(MlirAffineExpr affineExpr) {
return affineExpr.ptr == NULL;
}
-/** Prints an affine expression by sending chunks of the string representation
- * and forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints an affine expression by sending chunks of the string representation
+/// and forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr affineExpr,
MlirStringCallback callback,
void *userData);
@@ -64,17 +63,17 @@ MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr affineExpr,
/// Prints the affine expression to the standard error stream.
MLIR_CAPI_EXPORTED void mlirAffineExprDump(MlirAffineExpr affineExpr);
-/** Checks whether the given affine expression is made out of only symbols and
- * constants. */
+/// Checks whether the given affine expression is made out of only symbols and
+/// constants.
MLIR_CAPI_EXPORTED bool
mlirAffineExprIsSymbolicOrConstant(MlirAffineExpr affineExpr);
-/** Checks whether the given affine expression is a pure affine expression, i.e.
- * mul, floordiv, ceildic, and mod is only allowed w.r.t constants. */
+/// Checks whether the given affine expression is a pure affine expression, i.e.
+/// mul, floordiv, ceildic, and mod is only allowed w.r.t constants.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsPureAffine(MlirAffineExpr affineExpr);
-/** Returns the greatest known integral divisor of this affine expression. The
- * result is always positive. */
+/// Returns the greatest known integral divisor of this affine expression. The
+/// result is always positive.
MLIR_CAPI_EXPORTED int64_t
mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr);
@@ -82,8 +81,8 @@ mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr);
MLIR_CAPI_EXPORTED bool mlirAffineExprIsMultipleOf(MlirAffineExpr affineExpr,
int64_t factor);
-/** Checks whether the given affine expression involves AffineDimExpr
- * 'position'. */
+/// Checks whether the given affine expression involves AffineDimExpr
+/// 'position'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsFunctionOfDim(MlirAffineExpr affineExpr,
intptr_t position);
@@ -194,13 +193,13 @@ MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineCeilDivExprGet(MlirAffineExpr lhs,
/// Checks whether the given affine expression is binary.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsABinary(MlirAffineExpr affineExpr);
-/** Returns the left hand side affine expression of the given affine binary
- * operation expression. */
+/// Returns the left hand side affine expression of the given affine binary
+/// operation expression.
MLIR_CAPI_EXPORTED MlirAffineExpr
mlirAffineBinaryOpExprGetLHS(MlirAffineExpr affineExpr);
-/** Returns the right hand side affine expression of the given affine binary
- * operation expression. */
+/// Returns the right hand side affine expression of the given affine binary
+/// operation expression.
MLIR_CAPI_EXPORTED MlirAffineExpr
mlirAffineBinaryOpExprGetRHS(MlirAffineExpr affineExpr);
diff --git a/mlir/include/mlir-c/AffineMap.h b/mlir/include/mlir-c/AffineMap.h
index bf0c7c7b5381..de4f42f09f24 100644
--- a/mlir/include/mlir-c/AffineMap.h
+++ b/mlir/include/mlir-c/AffineMap.h
@@ -18,17 +18,16 @@ extern "C" {
#endif
//===----------------------------------------------------------------------===//
-/** Opaque type declarations.
- *
- * Types are exposed to C bindings as structs containing opaque pointers. They
- * are not supposed to be inspected from C. This allows the underlying
- * representation to change without affecting the API users. The use of structs
- * instead of typedefs enables some type safety as structs are not implicitly
- * convertible to each other.
- *
- * Instances of these types may or may not own the underlying object. The
- * ownership semantics is defined by how an instance of the type was obtained.
- */
+// Opaque type declarations.
+//
+// Types are exposed to C bindings as structs containing opaque pointers. They
+// are not supposed to be inspected from C. This allows the underlying
+// representation to change without affecting the API users. The use of structs
+// instead of typedefs enables some type safety as structs are not implicitly
+// convertible to each other.
+//
+// Instances of these types may or may not own the underlying object. The
+// ownership semantics is defined by how an instance of the type was obtained.
//===----------------------------------------------------------------------===//
#define DEFINE_C_API_STRUCT(name, storage) \
@@ -52,9 +51,9 @@ static inline bool mlirAffineMapIsNull(MlirAffineMap affineMap) {
/// Checks if two affine maps are equal.
MLIR_CAPI_EXPORTED bool mlirAffineMapEqual(MlirAffineMap a1, MlirAffineMap a2);
-/** Prints an affine map by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints an affine map by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirAffineMapPrint(MlirAffineMap affineMap,
MlirStringCallback callback,
void *userData);
@@ -62,52 +61,52 @@ MLIR_CAPI_EXPORTED void mlirAffineMapPrint(MlirAffineMap affineMap,
/// Prints the affine map to the standard error stream.
MLIR_CAPI_EXPORTED void mlirAffineMapDump(MlirAffineMap affineMap);
-/** Creates a zero result affine map with no dimensions or symbols in the
- * context. The affine map is owned by the context. */
+/// Creates a zero result affine map with no dimensions or symbols in the
+/// context. The affine map is owned by the context.
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapEmptyGet(MlirContext ctx);
-/** Creates a zero result affine map of the given dimensions and symbols in the
- * context. The affine map is owned by the context. */
+/// Creates a zero result affine map of the given dimensions and symbols in the
+/// context. The affine map is owned by the context.
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapZeroResultGet(
MlirContext ctx, intptr_t dimCount, intptr_t symbolCount);
-/** Creates an affine map with results defined by the given list of affine
- * expressions. The map resulting map also has the requested number of input
- * dimensions and symbols, regardless of them being used in the results.
- */
+/// Creates an affine map with results defined by the given list of affine
+/// expressions. The map resulting map also has the requested number of input
+/// dimensions and symbols, regardless of them being used in the results.
+
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapGet(MlirContext ctx,
intptr_t dimCount,
intptr_t symbolCount,
intptr_t nAffineExprs,
MlirAffineExpr *affineExprs);
-/** Creates a single constant result affine map in the context. The affine map
- * is owned by the context. */
+/// Creates a single constant result affine map in the context. The affine map
+/// is owned by the context.
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapConstantGet(MlirContext ctx,
int64_t val);
-/** Creates an affine map with 'numDims' identity in the context. The affine map
- * is owned by the context. */
+/// Creates an affine map with 'numDims' identity in the context. The affine map
+/// is owned by the context.
MLIR_CAPI_EXPORTED MlirAffineMap
mlirAffineMapMultiDimIdentityGet(MlirContext ctx, intptr_t numDims);
-/** Creates an identity affine map on the most minor dimensions in the context.
- * The affine map is owned by the context. The function asserts that the number
- * of dimensions is greater or equal to the number of results. */
+/// Creates an identity affine map on the most minor dimensions in the context.
+/// The affine map is owned by the context. The function asserts that the number
+/// of dimensions is greater or equal to the number of results.
MLIR_CAPI_EXPORTED MlirAffineMap
mlirAffineMapMinorIdentityGet(MlirContext ctx, intptr_t dims, intptr_t results);
-/** Creates an affine map with a permutation expression and its size in the
- * context. The permutation expression is a non-empty vector of integers.
- * The elements of the permutation vector must be continuous from 0 and cannot
- * be repeated (i.e. `[1,2,0]` is a valid permutation. `[2,0]` or `[1,1,2]` is
- * an invalid invalid permutation.) The affine map is owned by the context. */
+/// Creates an affine map with a permutation expression and its size in the
+/// context. The permutation expression is a non-empty vector of integers.
+/// The elements of the permutation vector must be continuous from 0 and cannot
+/// be repeated (i.e. `[1,2,0]` is a valid permutation. `[2,0]` or `[1,1,2]` is
+/// an invalid invalid permutation.) The affine map is owned by the context.
MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapPermutationGet(
MlirContext ctx, intptr_t size, unsigned *permutation);
-/** Checks whether the given affine map is an identity affine map. The function
- * asserts that the number of dimensions is greater or equal to the number of
- * results. */
+/// Checks whether the given affine map is an identity affine map. The function
+/// asserts that the number of dimensions is greater or equal to the number of
+/// results.
MLIR_CAPI_EXPORTED bool mlirAffineMapIsIdentity(MlirAffineMap affineMap);
/// Checks whether the given affine map is a minor identity affine map.
@@ -116,12 +115,12 @@ MLIR_CAPI_EXPORTED bool mlirAffineMapIsMinorIdentity(MlirAffineMap affineMap);
/// Checks whether the given affine map is an empty affine map.
MLIR_CAPI_EXPORTED bool mlirAffineMapIsEmpty(MlirAffineMap affineMap);
-/** Checks whether the given affine map is a single result constant affine
- * map. */
+/// Checks whether the given affine map is a single result constant affine
+/// map.
MLIR_CAPI_EXPORTED bool mlirAffineMapIsSingleConstant(MlirAffineMap affineMap);
-/** Returns the constant result of the given affine map. The function asserts
- * that the map has a single constant result. */
+/// Returns the constant result of the given affine map. The function asserts
+/// that the map has a single constant result.
MLIR_CAPI_EXPORTED int64_t
mlirAffineMapGetSingleConstantResult(MlirAffineMap affineMap);
@@ -138,17 +137,17 @@ MLIR_CAPI_EXPORTED intptr_t mlirAffineMapGetNumResults(MlirAffineMap affineMap);
MLIR_CAPI_EXPORTED MlirAffineExpr
mlirAffineMapGetResult(MlirAffineMap affineMap, intptr_t pos);
-/** Returns the number of inputs (dimensions + symbols) of the given affine
- * map. */
+/// Returns the number of inputs (dimensions + symbols) of the given affine
+/// map.
MLIR_CAPI_EXPORTED intptr_t mlirAffineMapGetNumInputs(MlirAffineMap affineMap);
-/** Checks whether the given affine map represents a subset of a symbol-less
- * permutation map. */
+/// Checks whether the given affine map represents a subset of a symbol-less
+/// permutation map.
MLIR_CAPI_EXPORTED bool
mlirAffineMapIsProjectedPermutation(MlirAffineMap affineMap);
-/** Checks whether the given affine map represents a symbol-less permutation
- * map. */
+/// Checks whether the given affine map represents a symbol-less permutation
+/// map.
MLIR_CAPI_EXPORTED bool mlirAffineMapIsPermutation(MlirAffineMap affineMap);
/// Returns the affine map consisting of the `resultPos` subset.
@@ -156,17 +155,17 @@ MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapGetSubMap(MlirAffineMap affineMap,
intptr_t size,
intptr_t *resultPos);
-/** Returns the affine map consisting of the most major `numResults` results.
- * Returns the null AffineMap if the `numResults` is equal to zero.
- * Returns the `affineMap` if `numResults` is greater or equals to number of
- * results of the given affine map. */
+/// Returns the affine map consisting of the most major `numResults` results.
+/// Returns the null AffineMap if the `numResults` is equal to zero.
+/// Returns the `affineMap` if `numResults` is greater or equals to number of
+/// results of the given affine map.
MLIR_CAPI_EXPORTED MlirAffineMap
mlirAffineMapGetMajorSubMap(MlirAffineMap affineMap, intptr_t numResults);
-/** Returns the affine map consisting of the most minor `numResults` results.
- * Returns the null AffineMap if the `numResults` is equal to zero.
- * Returns the `affineMap` if `numResults` is greater or equals to number of
- * results of the given affine map. */
+/// Returns the affine map consisting of the most minor `numResults` results.
+/// Returns the null AffineMap if the `numResults` is equal to zero.
+/// Returns the `affineMap` if `numResults` is greater or equals to number of
+/// results of the given affine map.
MLIR_CAPI_EXPORTED MlirAffineMap
mlirAffineMapGetMinorSubMap(MlirAffineMap affineMap, intptr_t numResults);
diff --git a/mlir/include/mlir-c/BuiltinAttributes.h b/mlir/include/mlir-c/BuiltinAttributes.h
index 7c280f67e791..cc6db74968fc 100644
--- a/mlir/include/mlir-c/BuiltinAttributes.h
+++ b/mlir/include/mlir-c/BuiltinAttributes.h
@@ -29,8 +29,8 @@ extern "C" {
/// Checks whether the given attribute is an affine map attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAAffineMap(MlirAttribute attr);
-/** Creates an affine map attribute wrapping the given map. The attribute
- * belongs to the same context as the affine map. */
+/// Creates an affine map attribute wrapping the given map. The attribute
+/// belongs to the same context as the affine map.
MLIR_CAPI_EXPORTED MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map);
/// Returns the affine map wrapped in the given affine map attribute.
@@ -43,8 +43,8 @@ MLIR_CAPI_EXPORTED MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr);
/// Checks whether the given attribute is an array attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAArray(MlirAttribute attr);
-/** Creates an array element containing the given list of elements in the given
- * context. */
+/// Creates an array element containing the given list of elements in the given
+/// context.
MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGet(
MlirContext ctx, intptr_t numElements, MlirAttribute const *elements);
@@ -62,8 +62,8 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr,
/// Checks whether the given attribute is a dictionary attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADictionary(MlirAttribute attr);
-/** Creates a dictionary attribute containing the given list of elements in the
- * provided context. */
+/// 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 const *elements);
@@ -75,8 +75,8 @@ mlirDictionaryAttrGetNumElements(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirNamedAttribute
mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t pos);
-/** Returns the dictionary attribute element with the given name or NULL if the
- * given name does not exist in the dictionary. */
+/// Returns the dictionary attribute element with the given name or NULL if the
+/// given name does not exist in the dictionary.
MLIR_CAPI_EXPORTED MlirAttribute
mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name);
@@ -84,44 +84,44 @@ mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name);
// Floating point attribute.
//===----------------------------------------------------------------------===//
-/* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
- * relevant functions here. */
+// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
+// relevant functions here.
/// Checks whether the given attribute is a floating point attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAFloat(MlirAttribute attr);
-/** Creates a floating point attribute in the given context with the given
- * double value and double-precision FP semantics. */
+/// Creates a floating point attribute in the given context with the given
+/// double value and double-precision FP semantics.
MLIR_CAPI_EXPORTED MlirAttribute mlirFloatAttrDoubleGet(MlirContext ctx,
MlirType type,
double value);
-/** Same as "mlirFloatAttrDoubleGet", but if the type is not valid for a
- * construction of a FloatAttr, returns a null MlirAttribute. */
+/// Same as "mlirFloatAttrDoubleGet", but if the type is not valid for a
+/// construction of a FloatAttr, returns a null MlirAttribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirFloatAttrDoubleGetChecked(MlirType type, double value, MlirLocation loc);
-/** Returns the value stored in the given floating point attribute, interpreting
- * the value as double. */
+/// Returns the value stored in the given floating point attribute, interpreting
+/// the value as double.
MLIR_CAPI_EXPORTED double mlirFloatAttrGetValueDouble(MlirAttribute attr);
//===----------------------------------------------------------------------===//
// Integer attribute.
//===----------------------------------------------------------------------===//
-/* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
- * relevant functions here. */
+// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
+// relevant functions here.
/// Checks whether the given attribute is an integer attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAInteger(MlirAttribute attr);
-/** Creates an integer attribute of the given type with the given integer
- * value. */
+/// Creates an integer attribute of the given type with the given integer
+/// value.
MLIR_CAPI_EXPORTED MlirAttribute mlirIntegerAttrGet(MlirType type,
int64_t value);
-/** Returns the value stored in the given integer attribute, assuming the value
- * fits into a 64-bit integer. */
+/// Returns the value stored in the given integer attribute, assuming the value
+/// fits into a 64-bit integer.
MLIR_CAPI_EXPORTED int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr);
//===----------------------------------------------------------------------===//
@@ -151,20 +151,20 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAIntegerSet(MlirAttribute attr);
/// Checks whether the given attribute is an opaque attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAOpaque(MlirAttribute attr);
-/** Creates an opaque attribute in the given context associated with the dialect
- * identified by its namespace. The attribute contains opaque byte data of the
- * specified length (data need not be null-terminated). */
+/// Creates an opaque attribute in the given context associated with the dialect
+/// identified by its namespace. The attribute contains opaque byte data of the
+/// specified length (data need not be null-terminated).
MLIR_CAPI_EXPORTED MlirAttribute
mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
intptr_t dataLength, const char *data, MlirType type);
-/** Returns the namespace of the dialect with which the given opaque attribute
- * is associated. The namespace string is owned by the context. */
+/// Returns the namespace of the dialect with which the given opaque attribute
+/// is associated. The namespace string is owned by the context.
MLIR_CAPI_EXPORTED MlirStringRef
mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr);
-/** Returns the raw data as a string reference. The data remains live as long as
- * the context in which the attribute lives. */
+/// Returns the raw data as a string reference. The data remains live as long as
+/// the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr);
//===----------------------------------------------------------------------===//
@@ -174,18 +174,18 @@ MLIR_CAPI_EXPORTED MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr);
/// Checks whether the given attribute is a string attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr);
-/** Creates a string attribute in the given context containing the given string.
- */
+/// Creates a string attribute in the given context containing the given string.
+
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx,
MlirStringRef str);
-/** Creates a string attribute in the given context containing the given string.
- * Additionally, the attribute has the given type. */
+/// Creates a string attribute in the given context containing the given string.
+/// Additionally, the attribute has the given type.
MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type,
MlirStringRef str);
-/** Returns the attribute values as a string reference. The data remains live as
- * long as the context in which the attribute lives. */
+/// Returns the attribute values as a string reference. The data remains live as
+/// long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef mlirStringAttrGetValue(MlirAttribute attr);
//===----------------------------------------------------------------------===//
@@ -195,25 +195,25 @@ MLIR_CAPI_EXPORTED MlirStringRef mlirStringAttrGetValue(MlirAttribute attr);
/// Checks whether the given attribute is a symbol reference attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsASymbolRef(MlirAttribute attr);
-/** Creates a symbol reference attribute in the given context referencing a
- * symbol identified by the given string inside a list of nested references.
- * Each of the references in the list must not be nested. */
+/// Creates a symbol reference attribute in the given context referencing a
+/// symbol identified by the given string inside a list of nested references.
+/// Each of the references in the list must not be nested.
MLIR_CAPI_EXPORTED MlirAttribute
mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
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. */
+/// Returns the string reference to the root referenced symbol. The data remains
+/// live as long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef
mlirSymbolRefAttrGetRootReference(MlirAttribute attr);
-/** Returns the string reference to the leaf referenced symbol. The data remains
- * live as long as the context in which the attribute lives. */
+/// Returns the string reference to the leaf referenced symbol. The data remains
+/// live as long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef
mlirSymbolRefAttrGetLeafReference(MlirAttribute attr);
-/** Returns the number of references nested in the given symbol reference
- * attribute. */
+/// Returns the number of references nested in the given symbol reference
+/// attribute.
MLIR_CAPI_EXPORTED intptr_t
mlirSymbolRefAttrGetNumNestedReferences(MlirAttribute attr);
@@ -228,13 +228,13 @@ mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos);
/// Checks whether the given attribute is a flat symbol reference attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr);
-/** Creates a flat symbol reference attribute in the given context referencing a
- * symbol identified by the given string. */
+/// Creates a flat symbol reference attribute in the given context referencing a
+/// symbol identified by the given string.
MLIR_CAPI_EXPORTED MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx,
MlirStringRef symbol);
-/** Returns the referenced symbol as a string reference. The data remains live
- * as long as the context in which the attribute lives. */
+/// Returns the referenced symbol as a string reference. The data remains live
+/// as long as the context in which the attribute lives.
MLIR_CAPI_EXPORTED MlirStringRef
mlirFlatSymbolRefAttrGetValue(MlirAttribute attr);
@@ -245,8 +245,8 @@ mlirFlatSymbolRefAttrGetValue(MlirAttribute attr);
/// Checks whether the given attribute is a type attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsAType(MlirAttribute attr);
-/** Creates a type attribute wrapping the given type in the same context as the
- * type. */
+/// Creates a type attribute wrapping the given type in the same context as the
+/// type.
MLIR_CAPI_EXPORTED MlirAttribute mlirTypeAttrGet(MlirType type);
/// Returns the type stored in the given type attribute.
@@ -274,14 +274,14 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr,
intptr_t rank,
uint64_t *idxs);
-/** Checks whether the given rank-dimensional index is valid in the given
- * elements attribute. */
+/// Checks whether the given rank-dimensional index is valid in the given
+/// elements attribute.
MLIR_CAPI_EXPORTED bool
mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank, uint64_t *idxs);
-/** Gets the total number of elements in the given elements attribute. In order
- * to iterate over the attribute, obtain its type, which must be a statically
- * shaped type and use its sizes to build a multi-dimensional index. */
+/// Gets the total number of elements in the given elements attribute. In order
+/// to iterate over the attribute, obtain its type, which must be a statically
+/// shaped type and use its sizes to build a multi-dimensional index.
MLIR_CAPI_EXPORTED int64_t mlirElementsAttrGetNumElements(MlirAttribute attr);
//===----------------------------------------------------------------------===//
@@ -289,21 +289,21 @@ MLIR_CAPI_EXPORTED int64_t mlirElementsAttrGetNumElements(MlirAttribute attr);
//===----------------------------------------------------------------------===//
// TODO: decide on the interface and add support for complex elements.
-/* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
- * relevant functions here. */
+// TODO: add support for APFloat and APInt to LLVM IR C API, then expose the
+// relevant functions here.
/// Checks whether the given attribute is a dense elements attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseElements(MlirAttribute attr);
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseIntElements(MlirAttribute attr);
MLIR_CAPI_EXPORTED bool mlirAttributeIsADenseFPElements(MlirAttribute attr);
-/** Creates a dense elements attribute with the given Shaped type and elements
- * in the same context as the type. */
+/// Creates a dense elements attribute with the given Shaped type and elements
+/// in the same context as the type.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrGet(
MlirType shapedType, intptr_t numElements, MlirAttribute const *elements);
-/** Creates a dense elements attribute with the given Shaped type containing a
- * single replicated element (splat). */
+/// Creates a dense elements attribute with the given Shaped type containing a
+/// single replicated element (splat).
MLIR_CAPI_EXPORTED MlirAttribute
mlirDenseElementsAttrSplatGet(MlirType shapedType, MlirAttribute element);
MLIR_CAPI_EXPORTED MlirAttribute
@@ -321,9 +321,9 @@ mlirDenseElementsAttrFloatSplatGet(MlirType shapedType, float element);
MLIR_CAPI_EXPORTED MlirAttribute
mlirDenseElementsAttrDoubleSplatGet(MlirType shapedType, double element);
-/** Creates a dense elements attribute with the given shaped type from elements
- * of a specific type. Expects the element type of the shaped type to match the
- * data element type. */
+/// Creates a dense elements attribute with the given shaped type from elements
+/// of a specific type. Expects the element type of the shaped type to match the
+/// data element type.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrBoolGet(
MlirType shapedType, intptr_t numElements, const int *elements);
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrUInt32Get(
@@ -339,23 +339,23 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrFloatGet(
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrDoubleGet(
MlirType shapedType, intptr_t numElements, const double *elements);
-/** Creates a dense elements attribute with the given shaped type from string
- * elements. */
+/// Creates a dense elements attribute with the given shaped type from string
+/// elements.
MLIR_CAPI_EXPORTED MlirAttribute mlirDenseElementsAttrStringGet(
MlirType shapedType, intptr_t numElements, MlirStringRef *strs);
-/** Creates a dense elements attribute that has the same data as the given dense
- * elements attribute and a
diff erent shaped type. The new type must have the
- * same total number of elements. */
+/// Creates a dense elements attribute that has the same data as the given dense
+/// elements attribute and a
diff erent shaped type. The new type must have the
+/// same total number of elements.
MLIR_CAPI_EXPORTED MlirAttribute
mlirDenseElementsAttrReshapeGet(MlirAttribute attr, MlirType shapedType);
-/** Checks whether the given dense elements attribute contains a single
- * replicated value (splat). */
+/// Checks whether the given dense elements attribute contains a single
+/// replicated value (splat).
MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrIsSplat(MlirAttribute attr);
-/** Returns the single replicated value (splat) of a specific type contained by
- * the given dense elements attribute. */
+/// Returns the single replicated value (splat) of a specific type contained by
+/// the given dense elements attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirDenseElementsAttrGetSplatValue(MlirAttribute attr);
MLIR_CAPI_EXPORTED int
@@ -375,8 +375,8 @@ mlirDenseElementsAttrGetDoubleSplatValue(MlirAttribute attr);
MLIR_CAPI_EXPORTED MlirStringRef
mlirDenseElementsAttrGetStringSplatValue(MlirAttribute attr);
-/** Returns the pos-th value (flat contiguous indexing) of a specific type
- * contained by the given dense elements attribute. */
+/// Returns the pos-th value (flat contiguous indexing) of a specific type
+/// contained by the given dense elements attribute.
MLIR_CAPI_EXPORTED bool mlirDenseElementsAttrGetBoolValue(MlirAttribute attr,
intptr_t pos);
MLIR_CAPI_EXPORTED int32_t
@@ -394,7 +394,7 @@ mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos);
MLIR_CAPI_EXPORTED MlirStringRef
mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos);
-/** Returns the raw data of the given dense elements attribute. */
+/// Returns the raw data of the given dense elements attribute.
MLIR_CAPI_EXPORTED const void *
mlirDenseElementsAttrGetRawData(MlirAttribute attr);
@@ -414,21 +414,21 @@ MLIR_CAPI_EXPORTED bool mlirAttributeIsAOpaqueElements(MlirAttribute attr);
/// Checks whether the given attribute is a sparse elements attribute.
MLIR_CAPI_EXPORTED bool mlirAttributeIsASparseElements(MlirAttribute attr);
-/** Creates a sparse elements attribute of the given shape from a list of
- * indices and a list of associated values. Both lists are expected to be dense
- * elements attributes with the same number of elements. The list of indices is
- * expected to contain 64-bit integers. The attribute is created in the same
- * context as the type. */
+/// Creates a sparse elements attribute of the given shape from a list of
+/// indices and a list of associated values. Both lists are expected to be dense
+/// elements attributes with the same number of elements. The list of indices is
+/// expected to contain 64-bit integers. The attribute is created in the same
+/// context as the type.
MLIR_CAPI_EXPORTED MlirAttribute mlirSparseElementsAttribute(
MlirType shapedType, MlirAttribute denseIndices, MlirAttribute denseValues);
-/** Returns the dense elements attribute containing 64-bit integer indices of
- * non-null elements in the given sparse elements attribute. */
+/// Returns the dense elements attribute containing 64-bit integer indices of
+/// non-null elements in the given sparse elements attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirSparseElementsAttrGetIndices(MlirAttribute attr);
-/** Returns the dense elements attribute containing the non-null elements in the
- * given sparse elements attribute. */
+/// Returns the dense elements attribute containing the non-null elements in the
+/// given sparse elements attribute.
MLIR_CAPI_EXPORTED MlirAttribute
mlirSparseElementsAttrGetValues(MlirAttribute attr);
diff --git a/mlir/include/mlir-c/BuiltinTypes.h b/mlir/include/mlir-c/BuiltinTypes.h
index 9712d58ad87a..cb942da1ae1a 100644
--- a/mlir/include/mlir-c/BuiltinTypes.h
+++ b/mlir/include/mlir-c/BuiltinTypes.h
@@ -25,18 +25,18 @@ extern "C" {
/// Checks whether the given type is an integer type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAInteger(MlirType type);
-/** Creates a signless integer type of the given bitwidth in the context. The
- * type is owned by the context. */
+/// Creates a signless integer type of the given bitwidth in the context. The
+/// type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeGet(MlirContext ctx,
unsigned bitwidth);
-/** Creates a signed integer type of the given bitwidth in the context. The type
- * is owned by the context. */
+/// Creates a signed integer type of the given bitwidth in the context. The type
+/// is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeSignedGet(MlirContext ctx,
unsigned bitwidth);
-/** Creates an unsigned integer type of the given bitwidth in the context. The
- * type is owned by the context. */
+/// Creates an unsigned integer type of the given bitwidth in the context. The
+/// type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx,
unsigned bitwidth);
@@ -59,8 +59,8 @@ MLIR_CAPI_EXPORTED bool mlirIntegerTypeIsUnsigned(MlirType type);
/// Checks whether the given type is an index type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAIndex(MlirType type);
-/** Creates an index type in the given context. The type is owned by the
- * context. */
+/// Creates an index type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirIndexTypeGet(MlirContext ctx);
//===----------------------------------------------------------------------===//
@@ -70,29 +70,29 @@ MLIR_CAPI_EXPORTED MlirType mlirIndexTypeGet(MlirContext ctx);
/// Checks whether the given type is a bf16 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsABF16(MlirType type);
-/** Creates a bf16 type in the given context. The type is owned by the
- * context. */
+/// Creates a bf16 type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirBF16TypeGet(MlirContext ctx);
/// Checks whether the given type is an f16 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF16(MlirType type);
-/** Creates an f16 type in the given context. The type is owned by the
- * context. */
+/// Creates an f16 type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirF16TypeGet(MlirContext ctx);
/// Checks whether the given type is an f32 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF32(MlirType type);
-/** Creates an f32 type in the given context. The type is owned by the
- * context. */
+/// Creates an f32 type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirF32TypeGet(MlirContext ctx);
/// Checks whether the given type is an f64 type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAF64(MlirType type);
-/** Creates a f64 type in the given context. The type is owned by the
- * context. */
+/// Creates a f64 type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirF64TypeGet(MlirContext ctx);
//===----------------------------------------------------------------------===//
@@ -102,8 +102,8 @@ MLIR_CAPI_EXPORTED MlirType mlirF64TypeGet(MlirContext ctx);
/// Checks whether the given type is a None type.
MLIR_CAPI_EXPORTED bool mlirTypeIsANone(MlirType type);
-/** Creates a None type in the given context. The type is owned by the
- * context. */
+/// Creates a None type in the given context. The type is owned by the
+/// context.
MLIR_CAPI_EXPORTED MlirType mlirNoneTypeGet(MlirContext ctx);
//===----------------------------------------------------------------------===//
@@ -113,8 +113,8 @@ MLIR_CAPI_EXPORTED MlirType mlirNoneTypeGet(MlirContext ctx);
/// Checks whether the given type is a Complex type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAComplex(MlirType type);
-/** Creates a complex type with the given element type in the same context as
- * the element type. The type is owned by the context. */
+/// Creates a complex type with the given element type in the same context as
+/// the element type. The type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirComplexTypeGet(MlirType elementType);
/// Returns the element type of the given complex type.
@@ -146,12 +146,12 @@ MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim);
MLIR_CAPI_EXPORTED int64_t mlirShapedTypeGetDimSize(MlirType type,
intptr_t dim);
-/** Checks whether the given value is used as a placeholder for dynamic sizes
- * in shaped types. */
+/// Checks whether the given value is used as a placeholder for dynamic sizes
+/// in shaped types.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicSize(int64_t size);
-/** Checks whether the given value is used as a placeholder for dynamic strides
- * and offsets in shaped types. */
+/// Checks whether the given value is used as a placeholder for dynamic strides
+/// and offsets in shaped types.
MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicStrideOrOffset(int64_t val);
//===----------------------------------------------------------------------===//
@@ -161,15 +161,15 @@ MLIR_CAPI_EXPORTED bool mlirShapedTypeIsDynamicStrideOrOffset(int64_t val);
/// Checks whether the given type is a Vector type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAVector(MlirType type);
-/** Creates a vector type of the shape identified by its rank and dimensions,
- * with the given element type in the same context as the element type. The type
- * is owned by the context. */
+/// Creates a vector type of the shape identified by its rank and dimensions,
+/// with the given element type in the same context as the element type. The
+/// type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGet(intptr_t rank,
const int64_t *shape,
MlirType elementType);
-/** Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on
- * illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on
+/// illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetChecked(intptr_t rank,
const int64_t *shape,
MlirType elementType,
@@ -188,25 +188,25 @@ MLIR_CAPI_EXPORTED bool mlirTypeIsARankedTensor(MlirType type);
/// Checks whether the given type is an unranked tensor type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAUnrankedTensor(MlirType type);
-/** Creates a tensor type of a fixed rank with the given shape and element type
- * in the same context as the element type. The type is owned by the context. */
+/// Creates a tensor type of a fixed rank with the given shape and element type
+/// in the same context as the element type. The type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGet(intptr_t rank,
const int64_t *shape,
MlirType elementType);
-/** Same as "mlirRankedTensorTypeGet" but returns a nullptr wrapping MlirType on
- * illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirRankedTensorTypeGet" but returns a nullptr wrapping MlirType on
+/// illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGetChecked(intptr_t rank,
const int64_t *shape,
MlirType elementType,
MlirLocation loc);
-/** Creates an unranked tensor type with the given element type in the same
- * context as the element type. The type is owned by the context. */
+/// Creates an unranked tensor type with the given element type in the same
+/// context as the element type. The type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirUnrankedTensorTypeGet(MlirType elementType);
-/** Same as "mlirUnrankedTensorTypeGet" but returns a nullptr wrapping MlirType
- * on illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirUnrankedTensorTypeGet" but returns a nullptr wrapping MlirType
+/// on illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType
mlirUnrankedTensorTypeGetChecked(MlirType elementType, MlirLocation loc);
@@ -220,41 +220,41 @@ MLIR_CAPI_EXPORTED bool mlirTypeIsAMemRef(MlirType type);
/// Checks whether the given type is an UnrankedMemRef type.
MLIR_CAPI_EXPORTED bool mlirTypeIsAUnrankedMemRef(MlirType type);
-/** Creates a MemRef type with the given rank and shape, a potentially empty
- * list of affine layout maps, the given memory space and element type, in the
- * same context as element type. The type is owned by the context. */
+/// Creates a MemRef type with the given rank and shape, a potentially empty
+/// list of affine layout maps, the given memory space and element type, in the
+/// same context as element type. The type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(
MlirType elementType, intptr_t rank, const int64_t *shape, intptr_t numMaps,
MlirAffineMap const *affineMaps, unsigned memorySpace);
-/** Same as "mlirMemRefTypeGet" but returns a nullptr-wrapping MlirType o
- * illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirMemRefTypeGet" but returns a nullptr-wrapping MlirType o
+/// illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGetChecked(
MlirType elementType, intptr_t rank, const int64_t *shape, intptr_t numMaps,
MlirAffineMap const *affineMaps, unsigned memorySpace, MlirLocation loc);
-/** Creates a MemRef type with the given rank, shape, memory space and element
- * type in the same context as the element type. The type has no affine maps,
- * i.e. represents a default row-major contiguous memref. The type is owned by
- * the context. */
+/// Creates a MemRef type with the given rank, shape, memory space and element
+/// type in the same context as the element type. The type has no affine maps,
+/// i.e. represents a default row-major contiguous memref. The type is owned by
+/// the context.
MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeContiguousGet(MlirType elementType,
intptr_t rank,
const int64_t *shape,
unsigned memorySpace);
-/** Same as "mlirMemRefTypeContiguousGet" but returns a nullptr wrapping
- * MlirType on illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirMemRefTypeContiguousGet" but returns a nullptr wrapping
+/// MlirType on illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeContiguousGetChecked(
MlirType elementType, intptr_t rank, const int64_t *shape,
unsigned memorySpace, MlirLocation loc);
-/** Creates an Unranked MemRef type with the given element type and in the given
- * memory space. The type is owned by the context of element type. */
+/// Creates an Unranked MemRef type with the given element type and in the given
+/// memory space. The type is owned by the context of element type.
MLIR_CAPI_EXPORTED MlirType mlirUnrankedMemRefTypeGet(MlirType elementType,
unsigned memorySpace);
-/** Same as "mlirUnrankedMemRefTypeGet" but returns a nullptr wrapping
- * MlirType on illegal arguments, emitting appropriate diagnostics. */
+/// Same as "mlirUnrankedMemRefTypeGet" but returns a nullptr wrapping
+/// MlirType on illegal arguments, emitting appropriate diagnostics.
MLIR_CAPI_EXPORTED MlirType mlirUnrankedMemRefTypeGetChecked(
MlirType elementType, unsigned memorySpace, MlirLocation loc);
@@ -278,8 +278,8 @@ MLIR_CAPI_EXPORTED unsigned mlirUnrankedMemrefGetMemorySpace(MlirType type);
/// Checks whether the given type is a tuple type.
MLIR_CAPI_EXPORTED bool mlirTypeIsATuple(MlirType type);
-/** Creates a tuple type that consists of the given list of elemental types. The
- * type is owned by the context. */
+/// Creates a tuple type that consists of the given list of elemental types. The
+/// type is owned by the context.
MLIR_CAPI_EXPORTED MlirType mlirTupleTypeGet(MlirContext ctx,
intptr_t numElements,
MlirType const *elements);
diff --git a/mlir/include/mlir-c/Diagnostics.h b/mlir/include/mlir-c/Diagnostics.h
index 14206b8454e7..884c67942ef6 100644
--- a/mlir/include/mlir-c/Diagnostics.h
+++ b/mlir/include/mlir-c/Diagnostics.h
@@ -21,8 +21,8 @@
extern "C" {
#endif
-/** An opaque reference to a diagnostic, always owned by the diagnostics engine
- * (context). Must not be stored outside of the diagnostic handler. */
+/// An opaque reference to a diagnostic, always owned by the diagnostics engine
+/// (context). Must not be stored outside of the diagnostic handler.
struct MlirDiagnostic {
void *ptr;
};
@@ -40,12 +40,12 @@ typedef enum MlirDiagnosticSeverity MlirDiagnosticSeverity;
/// Opaque identifier of a diagnostic handler, useful to detach a handler.
typedef uint64_t MlirDiagnosticHandlerID;
-/** Diagnostic handler type. Accepts a reference to a diagnostic, which is only
- * guaranteed to be live during the call. The handler is passed the `userData`
- * that was provided when the handler was attached to a context. If the handler
- * processed the diagnostic completely, it is expected to return success.
- * Otherwise, it is expected to return failure to indicate that other handlers
- * should attempt to process the diagnostic. */
+/// Diagnostic handler type. Accepts a reference to a diagnostic, which is only
+/// guaranteed to be live during the call. The handler is passed the `userData`
+/// that was provided when the handler was attached to a context. If the handler
+/// processed the diagnostic completely, it is expected to return success.
+/// Otherwise, it is expected to return failure to indicate that other handlers
+/// should attempt to process the diagnostic.
typedef MlirLogicalResult (*MlirDiagnosticHandler)(MlirDiagnostic,
void *userData);
@@ -66,31 +66,31 @@ mlirDiagnosticGetSeverity(MlirDiagnostic diagnostic);
MLIR_CAPI_EXPORTED intptr_t
mlirDiagnosticGetNumNotes(MlirDiagnostic diagnostic);
-/** Returns `pos`-th note attached to the diagnostic. Expects `pos` to be a
- * valid zero-based index into the list of notes. */
+/// Returns `pos`-th note attached to the diagnostic. Expects `pos` to be a
+/// valid zero-based index into the list of notes.
MLIR_CAPI_EXPORTED MlirDiagnostic
mlirDiagnosticGetNote(MlirDiagnostic diagnostic, intptr_t pos);
-/** Attaches the diagnostic handler to the context. Handlers are invoked in the
- * reverse order of attachment until one of them processes the diagnostic
- * completely. When a handler is invoked it is passed the `userData` that was
- * provided when it was attached. If non-NULL, `deleteUserData` is called once
- * the system no longer needs to call the handler (for instance after the
- * handler is detached or the context is destroyed). Returns an identifier that
- * can be used to detach the handler.
- */
+/// Attaches the diagnostic handler to the context. Handlers are invoked in the
+/// reverse order of attachment until one of them processes the diagnostic
+/// completely. When a handler is invoked it is passed the `userData` that was
+/// provided when it was attached. If non-NULL, `deleteUserData` is called once
+/// the system no longer needs to call the handler (for instance after the
+/// handler is detached or the context is destroyed). Returns an identifier that
+/// can be used to detach the handler.
+
MLIR_CAPI_EXPORTED MlirDiagnosticHandlerID mlirContextAttachDiagnosticHandler(
MlirContext context, MlirDiagnosticHandler handler, void *userData,
void (*deleteUserData)(void *));
-/** Detaches an attached diagnostic handler from the context given its
- * identifier. */
+/// Detaches an attached diagnostic handler from the context given its
+/// identifier.
MLIR_CAPI_EXPORTED void
mlirContextDetachDiagnosticHandler(MlirContext context,
MlirDiagnosticHandlerID id);
-/** Emits an error at the given location through the diagnostics engine. Used
- * for testing purposes. */
+/// Emits an error at the given location through the diagnostics engine. Used
+/// for testing purposes.
MLIR_CAPI_EXPORTED void mlirEmitError(MlirLocation location,
const char *message);
diff --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h
index 39f42e4bf497..2af813fbcdad 100644
--- a/mlir/include/mlir-c/IR.h
+++ b/mlir/include/mlir-c/IR.h
@@ -28,18 +28,18 @@ extern "C" {
#endif
//===----------------------------------------------------------------------===//
-/** Opaque type declarations.
- *
- * Types are exposed to C bindings as structs containing opaque pointers. They
- * are not supposed to be inspected from C. This allows the underlying
- * representation to change without affecting the API users. The use of structs
- * instead of typedefs enables some type safety as structs are not implicitly
- * convertible to each other.
- *
- * Instances of these types may or may not own the underlying object (most often
- * only point to an IR fragment without owning it). The ownership semantics is
- * defined by how an instance of the type was obtained.
- */
+/// Opaque type declarations.
+///
+/// Types are exposed to C bindings as structs containing opaque pointers. They
+/// are not supposed to be inspected from C. This allows the underlying
+/// representation to change without affecting the API users. The use of structs
+/// instead of typedefs enables some type safety as structs are not implicitly
+/// convertible to each other.
+///
+/// Instances of these types may or may not own the underlying object (most
+/// often only point to an IR fragment without owning it). The ownership
+/// semantics is defined by how an instance of the type was obtained.
+
//===----------------------------------------------------------------------===//
#define DEFINE_C_API_STRUCT(name, storage) \
@@ -64,11 +64,11 @@ DEFINE_C_API_STRUCT(MlirValue, const void);
#undef DEFINE_C_API_STRUCT
-/** Named MLIR attribute.
- *
- * A named attribute is essentially a (name, attribute) pair where the name is
- * a string.
- */
+/// Named MLIR attribute.
+///
+/// A named attribute is essentially a (name, attribute) pair where the name is
+/// a string.
+
struct MlirNamedAttribute {
MlirIdentifier name;
MlirAttribute attribute;
@@ -101,21 +101,21 @@ mlirContextSetAllowUnregisteredDialects(MlirContext context, bool allow);
MLIR_CAPI_EXPORTED bool
mlirContextGetAllowUnregisteredDialects(MlirContext context);
-/** Returns the number of dialects registered with the given context. A
- * registered dialect will be loaded if needed by the parser. */
+/// Returns the number of dialects registered with the given context. A
+/// registered dialect will be loaded if needed by the parser.
MLIR_CAPI_EXPORTED intptr_t
mlirContextGetNumRegisteredDialects(MlirContext context);
-/** Returns the number of dialects loaded by the context.
- */
+/// Returns the number of dialects loaded by the context.
+
MLIR_CAPI_EXPORTED intptr_t
mlirContextGetNumLoadedDialects(MlirContext context);
-/** Gets the dialect instance owned by the given context using the dialect
- * namespace to identify it, loads (i.e., constructs the instance of) the
- * dialect if necessary. If the dialect is not registered with the context,
- * returns null. Use mlirContextLoad<Name>Dialect to load an unregistered
- * dialect. */
+/// Gets the dialect instance owned by the given context using the dialect
+/// namespace to identify it, loads (i.e., constructs the instance of) the
+/// dialect if necessary. If the dialect is not registered with the context,
+/// returns null. Use mlirContextLoad<Name>Dialect to load an unregistered
+/// dialect.
MLIR_CAPI_EXPORTED MlirDialect mlirContextGetOrLoadDialect(MlirContext context,
MlirStringRef name);
@@ -131,8 +131,8 @@ static inline bool mlirDialectIsNull(MlirDialect dialect) {
return !dialect.ptr;
}
-/** Checks if two dialects that belong to the same context are equal. Dialects
- * from
diff erent contexts will not compare equal. */
+/// Checks if two dialects that belong to the same context are equal. Dialects
+/// from
diff erent contexts will not compare equal.
MLIR_CAPI_EXPORTED bool mlirDialectEqual(MlirDialect dialect1,
MlirDialect dialect2);
@@ -165,9 +165,9 @@ static inline bool mlirLocationIsNull(MlirLocation location) {
/// Checks if two locations are equal.
MLIR_CAPI_EXPORTED bool mlirLocationEqual(MlirLocation l1, MlirLocation l2);
-/** Prints a location by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints a location by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirLocationPrint(MlirLocation location,
MlirStringCallback callback,
void *userData);
@@ -202,16 +202,16 @@ MLIR_CAPI_EXPORTED MlirOperation mlirModuleGetOperation(MlirModule module);
// Operation state.
//===----------------------------------------------------------------------===//
-/** An auxiliary class for constructing operations.
- *
- * This class contains all the information necessary to construct the operation.
- * It owns the MlirRegions it has pointers to and does not own anything else.
- * By default, the state can be constructed from a name and location, the latter
- * being also used to access the context, and has no other components. These
- * components can be added progressively until the operation is constructed.
- * Users are not expected to rely on the internals of this class and should use
- * mlirOperationState* functions instead.
- */
+/// An auxiliary class for constructing operations.
+///
+/// This class contains all the information necessary to construct the
+/// operation. It owns the MlirRegions it has pointers to and does not own
+/// anything else. By default, the state can be constructed from a name and
+/// location, the latter being also used to access the context, and has no other
+/// components. These components can be added progressively until the operation
+/// is constructed. Users are not expected to rely on the internals of this
+/// class and should use mlirOperationState* functions instead.
+
struct MlirOperationState {
MlirStringRef name;
MlirLocation location;
@@ -265,24 +265,24 @@ mlirOperationStateEnableResultTypeInference(MlirOperationState *state);
// functions to maximize the possibility of compatibility over time.
//===----------------------------------------------------------------------===//
-/** Creates new printing flags with defaults, intended for customization.
- * Must be freed with a call to mlirOpPrintingFlagsDestroy(). */
+/// Creates new printing flags with defaults, intended for customization.
+/// Must be freed with a call to mlirOpPrintingFlagsDestroy().
MLIR_CAPI_EXPORTED MlirOpPrintingFlags mlirOpPrintingFlagsCreate();
/// Destroys printing flags created with mlirOpPrintingFlagsCreate.
MLIR_CAPI_EXPORTED void mlirOpPrintingFlagsDestroy(MlirOpPrintingFlags flags);
-/** Enables the elision of large elements attributes by printing a lexically
- * valid but otherwise meaningless form instead of the element data. The
- * `largeElementLimit` is used to configure what is considered to be a "large"
- * ElementsAttr by providing an upper limit to the number of elements. */
+/// Enables the elision of large elements attributes by printing a lexically
+/// valid but otherwise meaningless form instead of the element data. The
+/// `largeElementLimit` is used to configure what is considered to be a "large"
+/// ElementsAttr by providing an upper limit to the number of elements.
MLIR_CAPI_EXPORTED void
mlirOpPrintingFlagsElideLargeElementsAttrs(MlirOpPrintingFlags flags,
intptr_t largeElementLimit);
-/** Enable printing of debug information. If 'prettyForm' is set to true,
- * debug information is printed in a more readable 'pretty' form. Note: The
- * IR generated with 'prettyForm' is not parsable. */
+/// Enable printing of debug information. If 'prettyForm' is set to true,
+/// debug information is printed in a more readable 'pretty' form. Note: The
+/// IR generated with 'prettyForm' is not parsable.
MLIR_CAPI_EXPORTED void
mlirOpPrintingFlagsEnableDebugInfo(MlirOpPrintingFlags flags, bool prettyForm);
@@ -290,10 +290,10 @@ mlirOpPrintingFlagsEnableDebugInfo(MlirOpPrintingFlags flags, bool prettyForm);
MLIR_CAPI_EXPORTED void
mlirOpPrintingFlagsPrintGenericOpForm(MlirOpPrintingFlags flags);
-/** Use local scope when printing the operation. This allows for using the
- * printer in a more localized and thread-safe setting, but may not
- * necessarily be identical to what the IR will look like when dumping
- * the full module. */
+/// Use local scope when printing the operation. This allows for using the
+/// printer in a more localized and thread-safe setting, but may not
+/// necessarily be identical to what the IR will look like when dumping
+/// the full module.
MLIR_CAPI_EXPORTED void
mlirOpPrintingFlagsUseLocalScope(MlirOpPrintingFlags flags);
@@ -317,20 +317,20 @@ MLIR_CAPI_EXPORTED void mlirOperationDestroy(MlirOperation op);
/// Checks whether the underlying operation is null.
static inline bool mlirOperationIsNull(MlirOperation op) { return !op.ptr; }
-/** Checks whether two operation handles point to the same operation. This does
- * not perform deep comparison. */
+/// Checks whether two operation handles point to the same operation. This does
+/// not perform deep comparison.
MLIR_CAPI_EXPORTED bool mlirOperationEqual(MlirOperation op,
MlirOperation other);
/// Gets the name of the operation as an identifier.
MLIR_CAPI_EXPORTED MlirIdentifier mlirOperationGetName(MlirOperation op);
-/** Gets the block that owns this operation, returning null if the operation is
- * not owned. */
+/// Gets the block that owns this operation, returning null if the operation is
+/// not owned.
MLIR_CAPI_EXPORTED MlirBlock mlirOperationGetBlock(MlirOperation op);
-/** Gets the operation that owns this operation, returning null if the operation
- * is not owned. */
+/// Gets the operation that owns this operation, returning null if the operation
+/// is not owned.
MLIR_CAPI_EXPORTED MlirOperation
mlirOperationGetParentOperation(MlirOperation op);
@@ -341,8 +341,8 @@ MLIR_CAPI_EXPORTED intptr_t mlirOperationGetNumRegions(MlirOperation op);
MLIR_CAPI_EXPORTED MlirRegion mlirOperationGetRegion(MlirOperation op,
intptr_t pos);
-/** Returns an operation immediately following the given operation it its
- * enclosing block. */
+/// Returns an operation immediately following the given operation it its
+/// enclosing block.
MLIR_CAPI_EXPORTED MlirOperation mlirOperationGetNextInBlock(MlirOperation op);
/// Returns the number of operands of the operation.
@@ -377,26 +377,26 @@ mlirOperationGetAttribute(MlirOperation op, intptr_t pos);
MLIR_CAPI_EXPORTED MlirAttribute
mlirOperationGetAttributeByName(MlirOperation op, MlirStringRef name);
-/** Sets an attribute by name, replacing the existing if it exists or
- * adding a new one otherwise. */
+/// Sets an attribute by name, replacing the existing if it exists or
+/// adding a new one otherwise.
MLIR_CAPI_EXPORTED void mlirOperationSetAttributeByName(MlirOperation op,
MlirStringRef name,
MlirAttribute attr);
-/** Removes an attribute by name. Returns false if the attribute was not found
- * and true if removed. */
+/// Removes an attribute by name. Returns false if the attribute was not found
+/// and true if removed.
MLIR_CAPI_EXPORTED bool mlirOperationRemoveAttributeByName(MlirOperation op,
MlirStringRef name);
-/** Prints an operation by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints an operation by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirOperationPrint(MlirOperation op,
MlirStringCallback callback,
void *userData);
-/** Same as mlirOperationPrint but accepts flags controlling the printing
- * behavior. */
+/// Same as mlirOperationPrint but accepts flags controlling the printing
+/// behavior.
MLIR_CAPI_EXPORTED void mlirOperationPrintWithFlags(MlirOperation op,
MlirOpPrintingFlags flags,
MlirStringCallback callback,
@@ -428,22 +428,22 @@ MLIR_CAPI_EXPORTED MlirBlock mlirRegionGetFirstBlock(MlirRegion region);
MLIR_CAPI_EXPORTED void mlirRegionAppendOwnedBlock(MlirRegion region,
MlirBlock block);
-/** Takes a block owned by the caller and inserts it at `pos` to the given
- * region. This is an expensive operation that linearly scans the region, prefer
- * insertAfter/Before instead. */
+/// Takes a block owned by the caller and inserts it at `pos` to the given
+/// region. This is an expensive operation that linearly scans the region,
+/// prefer insertAfter/Before instead.
MLIR_CAPI_EXPORTED void
mlirRegionInsertOwnedBlock(MlirRegion region, intptr_t pos, MlirBlock block);
-/** Takes a block owned by the caller and inserts it after the (non-owned)
- * reference block in the given region. The reference block must belong to the
- * region. If the reference block is null, prepends the block to the region. */
+/// Takes a block owned by the caller and inserts it after the (non-owned)
+/// reference block in the given region. The reference block must belong to the
+/// region. If the reference block is null, prepends the block to the region.
MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockAfter(MlirRegion region,
MlirBlock reference,
MlirBlock block);
-/** Takes a block owned by the caller and inserts it before the (non-owned)
- * reference block in the given region. The reference block must belong to the
- * region. If the reference block is null, appends the block to the region. */
+/// Takes a block owned by the caller and inserts it before the (non-owned)
+/// reference block in the given region. The reference block must belong to the
+/// region. If the reference block is null, appends the block to the region.
MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockBefore(MlirRegion region,
MlirBlock reference,
MlirBlock block);
@@ -452,8 +452,8 @@ MLIR_CAPI_EXPORTED void mlirRegionInsertOwnedBlockBefore(MlirRegion region,
// Block API.
//===----------------------------------------------------------------------===//
-/** Creates a new empty block with the given argument types and transfers
- * ownership to the caller. */
+/// 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);
@@ -463,12 +463,12 @@ MLIR_CAPI_EXPORTED void mlirBlockDestroy(MlirBlock block);
/// Checks whether a block is null.
static inline bool mlirBlockIsNull(MlirBlock block) { return !block.ptr; }
-/** Checks whether two blocks handles point to the same block. This does not
- * perform deep comparison. */
+/// Checks whether two blocks handles point to the same block. This does not
+/// perform deep comparison.
MLIR_CAPI_EXPORTED bool mlirBlockEqual(MlirBlock block, MlirBlock other);
-/** Returns the block immediately following the given block in its parent
- * region. */
+/// Returns the block immediately following the given block in its parent
+/// region.
MLIR_CAPI_EXPORTED MlirBlock mlirBlockGetNextInRegion(MlirBlock block);
/// Returns the first operation in the block.
@@ -481,23 +481,23 @@ MLIR_CAPI_EXPORTED MlirOperation mlirBlockGetTerminator(MlirBlock block);
MLIR_CAPI_EXPORTED void mlirBlockAppendOwnedOperation(MlirBlock block,
MlirOperation operation);
-/** Takes an operation owned by the caller and inserts it as `pos` to the block.
- This is an expensive operation that scans the block linearly, prefer
- insertBefore/After instead. */
+/// Takes an operation owned by the caller and inserts it as `pos` to the block.
+/// This is an expensive operation that scans the block linearly, prefer
+/// insertBefore/After instead.
MLIR_CAPI_EXPORTED void mlirBlockInsertOwnedOperation(MlirBlock block,
intptr_t pos,
MlirOperation operation);
-/** Takes an operation owned by the caller and inserts it after the (non-owned)
- * reference operation in the given block. If the reference is null, prepends
- * the operation. Otherwise, the reference must belong to the block. */
+/// Takes an operation owned by the caller and inserts it after the (non-owned)
+/// reference operation in the given block. If the reference is null, prepends
+/// the operation. Otherwise, the reference must belong to the block.
MLIR_CAPI_EXPORTED void
mlirBlockInsertOwnedOperationAfter(MlirBlock block, MlirOperation reference,
MlirOperation operation);
-/** Takes an operation owned by the caller and inserts it before the (non-owned)
- * reference operation in the given block. If the reference is null, appends the
- * operation. Otherwise, the reference must belong to the block. */
+/// Takes an operation owned by the caller and inserts it before the (non-owned)
+/// reference operation in the given block. If the reference is null, appends
+/// the operation. Otherwise, the reference must belong to the block.
MLIR_CAPI_EXPORTED void
mlirBlockInsertOwnedOperationBefore(MlirBlock block, MlirOperation reference,
MlirOperation operation);
@@ -509,9 +509,9 @@ MLIR_CAPI_EXPORTED intptr_t mlirBlockGetNumArguments(MlirBlock block);
MLIR_CAPI_EXPORTED MlirValue mlirBlockGetArgument(MlirBlock block,
intptr_t pos);
-/** Prints a block by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints a block by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void
mlirBlockPrint(MlirBlock block, MlirStringCallback callback, void *userData);
@@ -531,8 +531,8 @@ MLIR_CAPI_EXPORTED bool mlirValueIsABlockArgument(MlirValue value);
/// Returns 1 if the value is an operation result, 0 otherwise.
MLIR_CAPI_EXPORTED bool mlirValueIsAOpResult(MlirValue value);
-/** Returns the block in which this value is defined as an argument. Asserts if
- * the value is not a block argument. */
+/// Returns the block in which this value is defined as an argument. Asserts if
+/// the value is not a block argument.
MLIR_CAPI_EXPORTED MlirBlock mlirBlockArgumentGetOwner(MlirValue value);
/// Returns the position of the value in the argument list of its block.
@@ -542,12 +542,12 @@ MLIR_CAPI_EXPORTED intptr_t mlirBlockArgumentGetArgNumber(MlirValue value);
MLIR_CAPI_EXPORTED void mlirBlockArgumentSetType(MlirValue value,
MlirType type);
-/** Returns an operation that produced this value as its result. Asserts if the
- * value is not an op result. */
+/// Returns an operation that produced this value as its result. Asserts if the
+/// value is not an op result.
MLIR_CAPI_EXPORTED MlirOperation mlirOpResultGetOwner(MlirValue value);
-/** Returns the position of the value in the list of results of the operation
- * that produced it. */
+/// Returns the position of the value in the list of results of the operation
+/// that produced it.
MLIR_CAPI_EXPORTED intptr_t mlirOpResultGetResultNumber(MlirValue value);
/// Returns the type of the value.
@@ -556,9 +556,9 @@ MLIR_CAPI_EXPORTED MlirType mlirValueGetType(MlirValue value);
/// Prints the value to the standard error stream.
MLIR_CAPI_EXPORTED void mlirValueDump(MlirValue value);
-/** Prints a value by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints a value by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void
mlirValuePrint(MlirValue value, MlirStringCallback callback, void *userData);
@@ -579,9 +579,9 @@ static inline bool mlirTypeIsNull(MlirType type) { return !type.ptr; }
/// Checks if two types are equal.
MLIR_CAPI_EXPORTED bool mlirTypeEqual(MlirType t1, MlirType t2);
-/** Prints a location by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints a location by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void
mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData);
@@ -608,9 +608,9 @@ static inline bool mlirAttributeIsNull(MlirAttribute attr) { return !attr.ptr; }
/// Checks if two attributes are equal.
MLIR_CAPI_EXPORTED bool mlirAttributeEqual(MlirAttribute a1, MlirAttribute a2);
-/** Prints an attribute by sending chunks of the string representation and
- * forwarding `userData to `callback`. Note that the callback may be called
- * several times with consecutive chunks of the string. */
+/// Prints an attribute by sending chunks of the string representation and
+/// forwarding `userData to `callback`. Note that the callback may be called
+/// several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirAttributePrint(MlirAttribute attr,
MlirStringCallback callback,
void *userData);
diff --git a/mlir/include/mlir-c/Pass.h b/mlir/include/mlir-c/Pass.h
index 1b408b6361ed..9669a53cd139 100644
--- a/mlir/include/mlir-c/Pass.h
+++ b/mlir/include/mlir-c/Pass.h
@@ -22,17 +22,16 @@ extern "C" {
#endif
//===----------------------------------------------------------------------===//
-/** Opaque type declarations.
- *
- * Types are exposed to C bindings as structs containing opaque pointers. They
- * are not supposed to be inspected from C. This allows the underlying
- * representation to change without affecting the API users. The use of structs
- * instead of typedefs enables some type safety as structs are not implicitly
- * convertible to each other.
- *
- * Instances of these types may or may not own the underlying object. The
- * ownership semantics is defined by how an instance of the type was obtained.
- */
+// Opaque type declarations.
+//
+// Types are exposed to C bindings as structs containing opaque pointers. They
+// are not supposed to be inspected from C. This allows the underlying
+// representation to change without affecting the API users. The use of structs
+// instead of typedefs enables some type safety as structs are not implicitly
+// convertible to each other.
+//
+// Instances of these types may or may not own the underlying object. The
+// ownership semantics is defined by how an instance of the type was obtained.
//===----------------------------------------------------------------------===//
#define DEFINE_C_API_STRUCT(name, storage) \
@@ -66,42 +65,42 @@ mlirPassManagerGetAsOpPassManager(MlirPassManager passManager);
MLIR_CAPI_EXPORTED MlirLogicalResult
mlirPassManagerRun(MlirPassManager passManager, MlirModule module);
-/** Nest an OpPassManager under the top-level PassManager, the nested
- * passmanager will only run on operations matching the provided name.
- * The returned OpPassManager will be destroyed when the parent is destroyed.
- * To further nest more OpPassManager under the newly returned one, see
- * `mlirOpPassManagerNest` below. */
+/// Nest an OpPassManager under the top-level PassManager, the nested
+/// passmanager will only run on operations matching the provided name.
+/// The returned OpPassManager will be destroyed when the parent is destroyed.
+/// To further nest more OpPassManager under the newly returned one, see
+/// `mlirOpPassManagerNest` below.
MLIR_CAPI_EXPORTED MlirOpPassManager mlirPassManagerGetNestedUnder(
MlirPassManager passManager, MlirStringRef operationName);
-/** Nest an OpPassManager under the provided OpPassManager, the nested
- * passmanager will only run on operations matching the provided name.
- * The returned OpPassManager will be destroyed when the parent is destroyed. */
+/// Nest an OpPassManager under the provided OpPassManager, the nested
+/// passmanager will only run on operations matching the provided name.
+/// The returned OpPassManager will be destroyed when the parent is destroyed.
MLIR_CAPI_EXPORTED MlirOpPassManager mlirOpPassManagerGetNestedUnder(
MlirOpPassManager passManager, MlirStringRef operationName);
-/** Add a pass and transfer ownership to the provided top-level mlirPassManager.
- * If the pass is not a generic operation pass or a ModulePass, a new
- * OpPassManager is implicitly nested under the provided PassManager. */
+/// Add a pass and transfer ownership to the provided top-level mlirPassManager.
+/// If the pass is not a generic operation pass or a ModulePass, a new
+/// OpPassManager is implicitly nested under the provided PassManager.
MLIR_CAPI_EXPORTED void mlirPassManagerAddOwnedPass(MlirPassManager passManager,
MlirPass pass);
-/** Add a pass and transfer ownership to the provided mlirOpPassManager. If the
- * pass is not a generic operation pass or matching the type of the provided
- * PassManager, a new OpPassManager is implicitly nested under the provided
- * PassManager. */
+/// Add a pass and transfer ownership to the provided mlirOpPassManager. If the
+/// pass is not a generic operation pass or matching the type of the provided
+/// PassManager, a new OpPassManager is implicitly nested under the provided
+/// PassManager.
MLIR_CAPI_EXPORTED void
mlirOpPassManagerAddOwnedPass(MlirOpPassManager passManager, MlirPass pass);
-/** Print a textual MLIR pass pipeline by sending chunks of the string
- * representation and forwarding `userData to `callback`. Note that the callback
- * may be called several times with consecutive chunks of the string. */
+/// Print a textual MLIR pass pipeline by sending chunks of the string
+/// representation and forwarding `userData to `callback`. Note that the
+/// callback may be called several times with consecutive chunks of the string.
MLIR_CAPI_EXPORTED void mlirPrintPassPipeline(MlirOpPassManager passManager,
MlirStringCallback callback,
void *userData);
-/** Parse a textual MLIR pass pipeline and add it to the provided OpPassManager.
- */
+/// Parse a textual MLIR pass pipeline and add it to the provided OpPassManager.
+
MLIR_CAPI_EXPORTED MlirLogicalResult
mlirParsePassPipeline(MlirOpPassManager passManager, MlirStringRef pipeline);
diff --git a/mlir/include/mlir-c/Support.h b/mlir/include/mlir-c/Support.h
index 6b5927afc431..340f8ec8bebf 100644
--- a/mlir/include/mlir-c/Support.h
+++ b/mlir/include/mlir-c/Support.h
@@ -46,18 +46,18 @@ extern "C" {
// MlirStringRef.
//===----------------------------------------------------------------------===//
-/** A pointer to a sized fragment of a string, not necessarily null-terminated.
- * Does not own the underlying string. This is equivalent to llvm::StringRef.
- */
+/// A pointer to a sized fragment of a string, not necessarily null-terminated.
+/// Does not own the underlying string. This is equivalent to llvm::StringRef.
+
struct MlirStringRef {
- const char *data; /**< Pointer to the first symbol. */
- size_t length; /**< Length of the fragment. */
+ const char *data; ///< Pointer to the first symbol.
+ size_t length; ///< Length of the fragment.
};
typedef struct MlirStringRef MlirStringRef;
-/** Constructs a string reference from the pointer and length. The pointer need
- * not reference to a null-terminated string.
- */
+/// Constructs a string reference from the pointer and length. The pointer need
+/// not reference to a null-terminated string.
+
inline static MlirStringRef mlirStringRefCreate(const char *str,
size_t length) {
MlirStringRef result;
@@ -66,30 +66,28 @@ inline static MlirStringRef mlirStringRefCreate(const char *str,
return result;
}
-/** Constructs a string reference from a null-terminated C string. Prefer
- * mlirStringRefCreate if the length of the string is known.
- */
+/// Constructs a string reference from a null-terminated C string. Prefer
+/// mlirStringRefCreate if the length of the string is known.
MLIR_CAPI_EXPORTED MlirStringRef
mlirStringRefCreateFromCString(const char *str);
-/** A callback for returning string references.
- *
- * This function is called back by the functions that need to return a reference
- * to the portion of the string with the following arguments:
- * - an MlirStringRef representing the current portion of the string
- * - a pointer to user data forwarded from the printing call.
- */
+/// A callback for returning string references.
+///
+/// This function is called back by the functions that need to return a
+/// reference to the portion of the string with the following arguments:
+/// - an MlirStringRef representing the current portion of the string
+/// - a pointer to user data forwarded from the printing call.
typedef void (*MlirStringCallback)(MlirStringRef, void *);
//===----------------------------------------------------------------------===//
// MlirLogicalResult.
//===----------------------------------------------------------------------===//
-/** A logical result value, essentially a boolean with named states. LLVM
- * convention for using boolean values to designate success or failure of an
- * operation is a moving target, so MLIR opted for an explicit class.
- * Instances of MlirLogicalResult must only be inspected using the associated
- * functions. */
+/// A logical result value, essentially a boolean with named states. LLVM
+/// convention for using boolean values to designate success or failure of an
+/// operation is a moving target, so MLIR opted for an explicit class.
+/// Instances of MlirLogicalResult must only be inspected using the associated
+/// functions.
struct MlirLogicalResult {
int8_t value;
};
More information about the llvm-branch-commits
mailing list