Skip to content

[DirectX] Avoid deprecated PointerUnion methods #122972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jan 14, 2025

PointerUnion's is, get, and dyn_cast have been deprecated in favour of using isa, cast, and dyn_cast directly. Migrate these uses over.

PointerUnion's `is`, `get`, and `dyn_cast` have been deprecated in
favour of using `isa`, `cast`, and `dyn_cast` directly. Migrate these
uses over.
@llvmbot
Copy link
Member

llvmbot commented Jan 14, 2025

@llvm/pr-subscribers-backend-directx

Author: Justin Bogner (bogner)

Changes

PointerUnion's is, get, and dyn_cast have been deprecated in favour of using isa, cast, and dyn_cast directly. Migrate these uses over.


Full diff: https://github.com/llvm/llvm-project/pull/122972.diff

1 Files Affected:

  • (modified) llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp (+3-3)
diff --git a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
index be68d46a876db2..0e064d7227cea8 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
@@ -1390,16 +1390,16 @@ void DXILBitcodeWriter::writeDISubrange(const DISubrange *N,
 
   // TODO: Do we need to handle DIExpression here? What about cases where Count
   // isn't specified but UpperBound and such are?
-  ConstantInt *Count = N->getCount().dyn_cast<ConstantInt *>();
+  ConstantInt *Count = dyn_cast<ConstantInt *>(N->getCount());
   assert(Count && "Count is missing or not ConstantInt");
   Record.push_back(Count->getValue().getSExtValue());
 
   // TODO: Similarly, DIExpression is allowed here now
   DISubrange::BoundType LowerBound = N->getLowerBound();
-  assert((LowerBound.isNull() || LowerBound.is<ConstantInt *>()) &&
+  assert((LowerBound.isNull() || isa<ConstantInt *>(LowerBound)) &&
          "Lower bound provided but not ConstantInt");
   Record.push_back(
-      LowerBound ? rotateSign(LowerBound.get<ConstantInt *>()->getValue()) : 0);
+      LowerBound ? rotateSign(cast<ConstantInt *>(LowerBound)->getValue()) : 0);
 
   Stream.EmitRecord(bitc::METADATA_SUBRANGE, Record, Abbrev);
   Record.clear();

@bogner bogner changed the title [DirectX] Avoid a deprecated PointerUnion methods [DirectX] Avoid deprecated PointerUnion methods Jan 14, 2025
@bogner bogner merged commit 31249e2 into llvm:main Jan 14, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants