From: Argyrios Kyrtzidis Date: Mon, 10 Sep 2012 22:04:26 +0000 (+0000) Subject: Move the null check outside of the loop, no functionality change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b22b0a53849dbb79da221fcc4671125ad49cb848;p=clang Move the null check outside of the loop, no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163553 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index aeaabce929..c4314b6f6c 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -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(NextDecl)) { - if (FieldName && FieldName == IF->getAnonField()->getIdentifier()) + if (FieldName == IF->getAnonField()->getIdentifier()) return IF; NextDecl = NextDecl->getNextDeclInContext(); }