From: Simon Pilgrim Date: Tue, 1 Oct 2019 21:50:30 +0000 (+0000) Subject: CGExprAgg - remove duplicate code. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d5285a4bfa9b092dd99c3fafc28f87cb012c1c9;p=clang CGExprAgg - remove duplicate code. NFCI. Remove duplicate getAs<> call, avoiding a clang static analyzer null dereference warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373396 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 0a57870a7c..9610a04be3 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -1759,7 +1759,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) { // referencee. InitListExprs for unions and arrays can't have references. if (const RecordType *RT = E->getType()->getAs()) { if (!RT->isUnionType()) { - RecordDecl *SD = E->getType()->getAs()->getDecl(); + RecordDecl *SD = RT->getDecl(); CharUnits NumNonZeroBytes = CharUnits::Zero(); unsigned ILEElement = 0;