Skip to content

Commit f13850a

Browse files
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123499)
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 Init to be nonnull. Note that hasInit returns true only if Init is nonnull among other conditions.
1 parent f7ebb13 commit f13850a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ Expr *VarDecl::getInit() {
23992399
if (!hasInit())
24002400
return nullptr;
24012401

2402-
if (auto *S = Init.dyn_cast<Stmt *>())
2402+
if (auto *S = dyn_cast<Stmt *>(Init))
24032403
return cast<Expr>(S);
24042404

24052405
auto *Eval = getEvaluatedStmt();

0 commit comments

Comments
 (0)