brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · a8873d0 Raw
69 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics| FileCheck %s2 3// CHECK-LABEL: @test_struct_attr_roundtrip4func.func @test_struct_attr_roundtrip() -> () {5  // CHECK: attr = #test.custom_struct<type_str = "struct", value = 2, opt_value = [3, 3]>6  "test.op"() {attr = #test.custom_struct<type_str = "struct", value = 2, opt_value = [3, 3]>} : () -> ()7  // CHECK: attr = #test.custom_struct<type_str = "struct", value = ?, opt_value = 1>8  "test.op"() {attr = #test.custom_struct<type_str = "struct", value = ?, opt_value = 1>} : () -> ()9  // CHECK: attr = #test.custom_struct<type_str = "struct", value = 2, opt_value = [3, 3]>10  "test.op"() {attr = #test.custom_struct<value = 2, type_str = "struct", opt_value = [3, 3]>} : () -> ()11  // CHECK: attr = #test.custom_struct<type_str = "struct", value = 2>12  "test.op"() {attr = #test.custom_struct<type_str = "struct", value = 2>} : () -> ()13  // CHECK: attr = #test.custom_struct<type_str = "struct", value = 2>14  "test.op"() {attr = #test.custom_struct<value = 2, type_str = "struct">} : () -> ()15  return16}17 18// -----19 20// Verify all required parameters must be provided. `value` is missing.21 22// expected-error @below {{struct is missing required parameter: value}}23"test.op"() {attr = #test.custom_struct<type_str = "struct">} : () -> ()24 25// -----26 27// Verify all keywords must be provided. All missing.28 29// expected-error @below {{expected valid keyword}}30// expected-error @below {{expected a parameter name in struct}}31"test.op"() {attr = #test.custom_struct<"struct", 2>} : () -> ()32 33// -----34 35// Verify all keywords must be provided. `type_str` missing.36 37// expected-error @below {{expected valid keyword}}38// expected-error @below {{expected a parameter name in struct}}39"test.op"() {attr = #test.custom_struct<"struct", value = 2, opt_value = [3, 3]>} : () -> ()40 41// -----42 43// Verify all keywords must be provided. `value` missing.44 45// expected-error @below {{expected valid keyword}}46// expected-error @below {{expected a parameter name in struct}}47"test.op"() {attr = #test.custom_struct<type_str = "struct", 2>} : () -> ()48 49// -----50 51// Verify invalid keyword provided.52 53// expected-error @below {{duplicate or unknown struct parameter name: type_str2}}54"test.op"() {attr = #test.custom_struct<type_str2 = "struct", value = 2>} : () -> ()55 56// -----57 58// Verify duplicated keyword provided.59 60// expected-error @below {{duplicate or unknown struct parameter name: type_str}}61"test.op"() {attr = #test.custom_struct<type_str = "struct", type_str = "struct2", value = 2>} : () -> ()62 63// -----64 65// Verify equals missing.66 67// expected-error @below {{expected '='}}68"test.op"() {attr = #test.custom_struct<type_str "struct", value = 2>} : () -> ()69