[Moore] Handle top-level typedefs by ignoring them

Typedefs are handled by Slang during type checking and don't need to be
lowered into anything in the IR. Therefore ignore top-level typedefs.
This commit is contained in:
Fabian Schuiki 2024-07-14 11:47:03 -07:00
parent 728a2197b3
commit dfd4483d01
No known key found for this signature in database
GPG Key ID: C42F5825FC5275E6
2 changed files with 17 additions and 0 deletions

View File

@ -431,6 +431,13 @@ Context::convertCompilation(slang::ast::Compilation &compilation) {
// which are listed separately as top instances.
for (auto *unit : root.compilationUnits) {
for (const auto &member : unit->members()) {
// Ignore top-level constructs that are handled by Slang as part of name
// resolution and type checking.
if (member.as_if<slang::ast::EmptyMemberSymbol>() ||
member.as_if<slang::ast::TransparentMemberSymbol>() ||
member.as_if<slang::ast::TypeAliasType>())
continue;
// Error out on all top-level declarations.
auto loc = convertLocation(member.location);
return mlir::emitError(loc, "unsupported construct: ")

View File

@ -4,6 +4,16 @@
// Internal issue in Slang v3 about jump depending on uninitialised value.
// UNSUPPORTED: valgrind
// Ignore time unit and precision.
timeunit 100ps;
timeprecision 10fs;
timeunit 100ps/10fs;
`timescale 100ps/10fs;
// Ignore type aliases and enum variant names imported into the parent scope.
typedef int MyInt;
typedef enum { VariantA, VariantB } MyEnum;
// CHECK-LABEL: moore.module @Empty() {
// CHECK: }
module Empty;