[mlir] fix the Disambiguate NoneType in OpDefinitionsGen (#172923)

Qualify NoneType as mlir::NoneType in recordToType to avoid ambiguity
when other headers introduce a different NoneType symbol. This fixes
build failures seen when enabling tblgen-to-irdl in certain downstream
configurations

The ambiguity is between:


[llvm::Nonetype](https://github.com/intel/llvm/blob/sycl/llvm/include/llvm/ADT/None.h#L26)
and
[mlir::Nonetype](https://github.com/llvm/llvm-project/blob/main/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp#L125)

Both are visible due to `using namespace mlir` and `using namespace
llvm` in the file.

Fixes: https://github.com/llvm/llvm-project/issues/160537
This commit is contained in:
Abhishek Bagusetty 2025-12-22 04:36:40 -06:00 committed by GitHub
parent da8497ed08
commit f6e79724ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,7 +122,7 @@ static std::optional<Type> recordToType(MLIRContext *ctx,
}
if (predRec.getName() == "NoneType") {
return NoneType::get(ctx);
return mlir::NoneType::get(ctx);
}
if (predRec.getName() == "BF16") {