[Mlir-commits] [mlir] [MLIR][DLTI] Enable types as keys in DLTI-query utils (PR #105995)
Mehdi Amini
llvmlistbot at llvm.org
Mon Aug 26 18:17:34 PDT 2024
================
@@ -438,6 +446,15 @@ FailureOr<Attribute> dlti::query(Operation *op, ArrayRef<StringAttr> keys,
return failure();
}
+ auto keyToStr = [](DataLayoutEntryKey key) -> std::string {
+ std::string buf;
+ llvm::TypeSwitch<DataLayoutEntryKey>(key)
+ .Case<StringAttr, Type>( // The only two kinds of key we know of.
+ [&](auto key) { llvm::raw_string_ostream(buf) << key; })
+ .Default([](auto) { llvm_unreachable("unexpected entry key kind"); });
+ return buf;
+ };
----------------
joker-eph wrote:
> This lambda is only invoked when emitError=true, i.e. these conversions to a string only happen when error messages get generated and solely in service of these error messages.
Oh alright then!
https://github.com/llvm/llvm-project/pull/105995
More information about the Mlir-commits
mailing list