Skip to content

Commit f559c2e

Browse files
committed
[clang][Sema][NFC] Use auto for dyn_cast<>
1 parent 165fdaa commit f559c2e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7162,13 +7162,11 @@ static bool CheckNonNullExpr(Sema &S, const Expr *Expr) {
71627162

71637163
// As a special case, transparent unions initialized with zero are
71647164
// considered null for the purposes of the nonnull attribute.
7165-
if (const RecordType *UT = Expr->getType()->getAsUnionType()) {
7166-
if (UT->getDecl()->hasAttr<TransparentUnionAttr>())
7167-
if (const CompoundLiteralExpr *CLE =
7168-
dyn_cast<CompoundLiteralExpr>(Expr))
7169-
if (const InitListExpr *ILE =
7170-
dyn_cast<InitListExpr>(CLE->getInitializer()))
7171-
Expr = ILE->getInit(0);
7165+
if (const RecordType *UT = Expr->getType()->getAsUnionType();
7166+
UT && UT->getDecl()->hasAttr<TransparentUnionAttr>()) {
7167+
if (const auto *CLE = dyn_cast<CompoundLiteralExpr>(Expr))
7168+
if (const auto *ILE = dyn_cast<InitListExpr>(CLE->getInitializer()))
7169+
Expr = ILE->getInit(0);
71727170
}
71737171

71747172
bool Result;

0 commit comments

Comments
 (0)