[Mlir-commits] [mlir] [MLIR] Add llvm (debug) attributes to CAPI (PR #83992)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Wed Mar 6 01:35:57 PST 2024
================
@@ -225,12 +226,157 @@ static int testStructTypeCreation(MlirContext ctx) {
return 0;
}
+// CHECK-LABEL: testLLVMAttributes
+static void testLLVMAttributes(MlirContext ctx) {
+ fprintf(stderr, "testLLVMAttributes\n");
+
+ // CHECK: #llvm.linkage<internal>
+ mlirAttributeDump(mlirLLVMLinkageAttrGet(ctx, 0x1));
+ // CHECK: #llvm.cconv<ccc>
+ mlirAttributeDump(mlirLLVMCConvAttrGet(ctx, 0x0));
+ // CHECK: #llvm<comdat any>
+ mlirAttributeDump(mlirLLVMComdatAttrGet(ctx, 0x0));
+}
+
+// CHECK-LABEL: testDebugInfoAttributes
+static void testDebugInfoAttributes(MlirContext ctx) {
+ fprintf(stderr, "testDebugInfoAttributes\n");
+
+ MlirAttribute foo =
+ mlirStringAttrGet(ctx, mlirStringRefCreateFromCString("foo"));
+ MlirAttribute bar =
+ mlirStringAttrGet(ctx, mlirStringRefCreateFromCString("bar"));
+ MlirAttribute id = mlirDisctinctAttrCreate(foo);
+
+ // CHECK: #llvm.di_null_type
+ mlirAttributeDump(mlirLLVMDINullTypeAttrGet(ctx));
+ // CHECK: #llvm.di_basic_type<tag = DW_TAG_null, name = "foo", sizeInBits =
+ // 64, encoding = DW_ATE_signed>
+ MlirAttribute di_type = mlirLLVMDIBasicTypeAttrGet(ctx, 0, foo, 64, 0x5);
----------------
ftynse wrote:
Ditto. As a code reader, I have no idea whether `0x5` corresponds to `DW_ATE_signed` or not so cannot understand whether the test is correct or not.
https://github.com/llvm/llvm-project/pull/83992
More information about the Mlir-commits
mailing list