[clang] [Serialization] Migrate away from PointerUnion::dyn_cast (NFC) (#124884) (PR #125024)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 29 20:18:41 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
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 expect Subject to be nonnull.
---
Full diff: https://github.com/llvm/llvm-project/pull/125024.diff
1 Files Affected:
- (modified) clang/lib/Serialization/ASTWriter.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index e81a441d753b5d..ef8ee5bc94d0ec 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5359,7 +5359,7 @@ ASTWriter::WriteAST(llvm::PointerUnion<Sema *, Preprocessor *> Subject,
llvm::TimeTraceScope scope("WriteAST", OutputFile);
WritingAST = true;
- Sema *SemaPtr = Subject.dyn_cast<Sema *>();
+ Sema *SemaPtr = dyn_cast<Sema *>(Subject);
Preprocessor &PPRef =
SemaPtr ? SemaPtr->getPreprocessor() : *cast<Preprocessor *>(Subject);
``````````
</details>
https://github.com/llvm/llvm-project/pull/125024
More information about the cfe-commits
mailing list