r373396 - CGExprAgg - remove duplicate code. NFCI.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 14:50:30 PDT 2019


Author: rksimon
Date: Tue Oct  1 14:50:30 2019
New Revision: 373396

URL: http://llvm.org/viewvc/llvm-project?rev=373396&view=rev
Log:
CGExprAgg - remove duplicate code. NFCI.

Remove duplicate getAs<> call, avoiding a clang static analyzer null dereference warning.

Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=373396&r1=373395&r2=373396&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Tue Oct  1 14:50:30 2019
@@ -1759,7 +1759,7 @@ static CharUnits GetNumNonZeroBytesInIni
   // 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;




More information about the cfe-commits mailing list