[clang] f559c2e - [clang][Sema][NFC] Use auto for dyn_cast<>
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 09:00:57 PST 2024
Author: Timm Bäder
Date: 2024-02-12T18:00:39+01:00
New Revision: f559c2efe195b54ebc0f0a0077918483a25a6ae4
URL: https://github.com/llvm/llvm-project/commit/f559c2efe195b54ebc0f0a0077918483a25a6ae4
DIFF: https://github.com/llvm/llvm-project/commit/f559c2efe195b54ebc0f0a0077918483a25a6ae4.diff
LOG: [clang][Sema][NFC] Use auto for dyn_cast<>
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 71e6e7230fc455..afe2673479e40a 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7162,13 +7162,11 @@ static bool CheckNonNullExpr(Sema &S, const Expr *Expr) {
// As a special case, transparent unions initialized with zero are
// considered null for the purposes of the nonnull attribute.
- if (const RecordType *UT = Expr->getType()->getAsUnionType()) {
- if (UT->getDecl()->hasAttr<TransparentUnionAttr>())
- if (const CompoundLiteralExpr *CLE =
- dyn_cast<CompoundLiteralExpr>(Expr))
- if (const InitListExpr *ILE =
- dyn_cast<InitListExpr>(CLE->getInitializer()))
- Expr = ILE->getInit(0);
+ if (const RecordType *UT = Expr->getType()->getAsUnionType();
+ UT && UT->getDecl()->hasAttr<TransparentUnionAttr>()) {
+ if (const auto *CLE = dyn_cast<CompoundLiteralExpr>(Expr))
+ if (const auto *ILE = dyn_cast<InitListExpr>(CLE->getInitializer()))
+ Expr = ILE->getInit(0);
}
bool Result;
More information about the cfe-commits
mailing list