]> granicus.if.org Git - clang/commitdiff
CGExprAgg - remove duplicate code. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 1 Oct 2019 21:50:30 +0000 (21:50 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 1 Oct 2019 21:50:30 +0000 (21:50 +0000)
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

lib/CodeGen/CGExprAgg.cpp

index 0a57870a7c583855891682bbe9ec1acfae9fa7f9..9610a04be343a882b70d850ce8b8bbf803d1d37e 100644 (file)
@@ -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<RecordType>()) {
     if (!RT->isUnionType()) {
-      RecordDecl *SD = E->getType()->getAs<RecordType>()->getDecl();
+      RecordDecl *SD = RT->getDecl();
       CharUnits NumNonZeroBytes = CharUnits::Zero();
 
       unsigned ILEElement = 0;