[Mlir-commits] [mlir] [MLIR] Improve translation of DISubrange. (PR #93689)
Christian Ulmann
llvmlistbot at llvm.org
Thu May 30 05:17:50 PDT 2024
================
@@ -314,11 +314,29 @@ llvm::DINamespace *DebugTranslation::translateImpl(DINamespaceAttr attr) {
}
llvm::DISubrange *DebugTranslation::translateImpl(DISubrangeAttr attr) {
- auto getMetadataOrNull = [&](IntegerAttr attr) -> llvm::Metadata * {
+ auto getMetadataOrNull = [&](Attribute attr) -> llvm::Metadata * {
if (!attr)
return nullptr;
- return llvm::ConstantAsMetadata::get(llvm::ConstantInt::getSigned(
- llvm::Type::getInt64Ty(llvmCtx), attr.getInt()));
+
+ llvm::Metadata *metadata =
+ llvm::TypeSwitch<Attribute, llvm::Metadata *>(attr)
+ .Case<IntegerAttr>([&](IntegerAttr intAttr) {
----------------
Dinistro wrote:
```suggestion
.Case([&](IntegerAttr intAttr) {
```
Nit: The template parameter is inferred from the type of the lambda, so it can be omitted here and in the other cases.
https://github.com/llvm/llvm-project/pull/93689
More information about the Mlir-commits
mailing list