Skip to content

Commit b91ba34

Browse files
committed
add verifier
1 parent bd0bb3c commit b91ba34

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,8 @@ def LLVM_AliasScopeAttr : LLVM_Attr<"AliasScope", "alias_scope"> {
900900
let summary = "LLVM dialect alias scope";
901901

902902
let assemblyFormat = "`<` struct(params) `>`";
903+
904+
let genVerifyDecl = 1;
903905
}
904906

905907
def LLVM_AliasScopeArrayAttr

mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ void LLVMDialect::registerAttributes() {
5252
>();
5353
}
5454

55+
//===----------------------------------------------------------------------===//
56+
// AliasScopeAttr
57+
//===----------------------------------------------------------------------===//
58+
59+
LogicalResult
60+
AliasScopeAttr::verify(function_ref<InFlightDiagnostic()> emitError,
61+
Attribute id, AliasScopeDomainAttr domain,
62+
StringAttr description) {
63+
(void)domain;
64+
(void)description;
65+
if (!llvm::isa<StringAttr, DistinctAttr>(id))
66+
return emitError()
67+
<< "id of an alias scope must be a StringAttr or a DistrinctAttr";
68+
69+
return success();
70+
}
71+
5572
//===----------------------------------------------------------------------===//
5673
// DINodeAttr
5774
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)