-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error if duplicated mnemonics are found.
We currently don't emit an error when a dialect defines two dialect operations with the same mnemonic. This change emits basic information about duplicate mnemonics. Since this requires a `O(n)` loop worst-case, store the mnemonic counts per dialect in a `StringMap` and iterate over it during finalization of the dialect, which then also bails out. Can possibly be extended to all kinds of duplicated symbols.
- Loading branch information
1 parent
c82337d
commit e6cbcfd
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// RUN: not --crash llvm-dialects-tblgen -gen-dialect-defs -dialect=dups -I%S/../../include %s 2>&1 | FileCheck --check-prefixes=CHECK %s | ||
|
||
// CHECK: Found op with non-unique mnemonic: duplicate.op | ||
// CHECK-NEXT: Found op with non-unique mnemonic: duplicate.op.1 | ||
// CHECK-NEXT: LLVM ERROR: Aborting dialect generation since non-unique mnemonics were found! | ||
|
||
include "llvm-dialects/Dialect/Dialect.td" | ||
|
||
def TestDialect : Dialect { | ||
let name = "dups"; | ||
let cppNamespace = "dups"; | ||
} | ||
|
||
class TestOp<string mnemonic_, list<Trait> traits_> | ||
: Op<TestDialect, mnemonic_, traits_>; | ||
|
||
def DuplicateOp : TestOp<"duplicate.op", | ||
[]> { | ||
let results = (outs); | ||
let arguments = (ins); | ||
} | ||
|
||
def DuplicateOp1 : TestOp<"duplicate.op", | ||
[]> { | ||
let results = (outs); | ||
let arguments = (ins); | ||
} | ||
|
||
def DuplicateOp2 : TestOp<"duplicate.op.1", | ||
[]> { | ||
let results = (outs); | ||
let arguments = (ins); | ||
} | ||
|
||
def DuplicateOp3 : TestOp<"duplicate.op.1", | ||
[]> { | ||
let results = (outs); | ||
let arguments = (ins); | ||
} | ||
|
||
def UniqueOp : TestOp<"unique.op", | ||
[]> { | ||
let results = (outs); | ||
let arguments = (ins); | ||
} |