Skip to content

[MLIR] Build issues when enabling mlir/tblgen-to-irdl #160537

@abagusetty

Description

@abagusetty

I encountered a build error when compiling the tblgen-to-irdl tool in MLIR. The error is due to an ambiguous reference to NoneType, which is defined in both MLIR (mlir::NoneType) and LLVM (llvm::NoneType).

Using gcc-13.3

Error:

.../llvm/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp: In function ‘std::optional<mlir::Type> recordToType(mlir::MLIRContext*, const llvm::Record&)’: .../llvm/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp:124:12: error: reference to ‘NoneType’ is ambiguous 124 | return NoneType::get(ctx); | ^~~~~~~~

Resolved with the following patch:
Qualify the symbol explicitly as mlir::NoneType::get(ctx) in OpDefinitionsGen.cpp to disambiguate.

- return NoneType::get(ctx); + return mlir::NoneType::get(ctx); 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions