[Mlir-commits] [mlir] [mlir] Migrate away from PointerUnion::dyn_cast (NFC) (PR #135770)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Apr 15 03:04:32 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-core
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we have a call to dyn_cast earlier in the function, implying
that attrOrProp is nonnull.
---
Full diff: https://github.com/llvm/llvm-project/pull/135770.diff
1 Files Affected:
- (modified) mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp (+1-1)
``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 2431807ce463d..edcb2f507ae50 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1828,7 +1828,7 @@ void OpEmitter::genPropertiesSupportForBytecode(
name, tgfmt(namedProperty->prop.getWriteToMlirBytecodeCall(), &fctx));
continue;
}
- const auto *namedAttr = attrOrProp.dyn_cast<const AttributeMetadata *>();
+ const auto *namedAttr = dyn_cast<const AttributeMetadata *>(attrOrProp);
StringRef name = namedAttr->attrName;
if (namedAttr->isRequired) {
readPropertiesMethod << formatv(R"(
``````````
</details>
https://github.com/llvm/llvm-project/pull/135770
More information about the Mlir-commits
mailing list