]> granicus.if.org Git - clang/commitdiff
Move the null check outside of the loop, no functionality change.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 10 Sep 2012 22:04:26 +0000 (22:04 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 10 Sep 2012 22:04:26 +0000 (22:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163553 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp

index aeaabce929f63dde6475e334ef539cdfc06e38ac..c4314b6f6ce7e593d5e47ae80380e84975aa2c3a 100644 (file)
@@ -1503,11 +1503,14 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef,
 ///  corresponds to FieldName.
 static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField,
                                                  IdentifierInfo *FieldName) {
+  if (!FieldName)
+    return 0;
+
   assert(AnonField->isAnonymousStructOrUnion());
   Decl *NextDecl = AnonField->getNextDeclInContext();
   while (IndirectFieldDecl *IF = 
           dyn_cast_or_null<IndirectFieldDecl>(NextDecl)) {
-    if (FieldName && FieldName == IF->getAnonField()->getIdentifier())
+    if (FieldName == IF->getAnonField()->getIdentifier())
       return IF;
     NextDecl = NextDecl->getNextDeclInContext();
   }