[Mlir-commits] [mlir] [MLIR] Improve translation of DISubrange. (PR #93689)

Christian Ulmann llvmlistbot at llvm.org
Thu May 30 05:17:50 PDT 2024


================
@@ -217,21 +217,33 @@ DISubprogramAttr DebugImporter::translateImpl(llvm::DISubprogram *node) {
 }
 
 DISubrangeAttr DebugImporter::translateImpl(llvm::DISubrange *node) {
-  auto getIntegerAttrOrNull = [&](llvm::DISubrange::BoundType data) {
-    if (auto *constInt = llvm::dyn_cast_or_null<llvm::ConstantInt *>(data))
+  auto getAttrOrNull =
+      [&](llvm::DISubrange::BoundType data) -> mlir::Attribute {
+    if (data.isNull())
+      return nullptr;
+    if (auto *constInt = llvm::dyn_cast<llvm::ConstantInt *>(data))
----------------
Dinistro wrote:

```suggestion
    if (auto *constInt = dyn_cast<llvm::ConstantInt *>(data))
```
Nit: `dyn_cast` is reexported in the `mlir` namespace, so it is not necessary to qualify this.
The same applies to all other casts in this PR.

https://github.com/llvm/llvm-project/pull/93689


More information about the Mlir-commits mailing list