]> granicus.if.org Git - clang/commitdiff
Switching to using dyn_cast_or_null, and fixing line endings in the test case.
authorAaron Ballman <aaron@aaronballman.com>
Thu, 9 Feb 2012 22:16:56 +0000 (22:16 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 9 Feb 2012 22:16:56 +0000 (22:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150209 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp
test/Sema/init.c

index 759fb16d1a7686f6c5f67177c796891b4e9e6e2d..6fff123b7a4bac639f2df3dd9308138e53564b9c 100644 (file)
@@ -1511,8 +1511,8 @@ static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField,
                                                  IdentifierInfo *FieldName) {
   assert(AnonField->isAnonymousStructOrUnion());
   Decl *NextDecl = AnonField->getNextDeclInContext();
-  IndirectFieldDecl *IF = NULL;
-  while (NextDecl && (IF = dyn_cast<IndirectFieldDecl>(NextDecl))) {
+  while (IndirectFieldDecl *IF = 
+          dyn_cast_or_null<IndirectFieldDecl>(NextDecl)) {
     if (FieldName && FieldName == IF->getAnonField()->getIdentifier())
       return IF;
     NextDecl = NextDecl->getNextDeclInContext();
index 4dcfafa4792bb925dc35b0135384b9ce4b804ce1..81a665dc6297d589c7e7f8e1d3a50a071424dc94 100644 (file)
@@ -18,12 +18,12 @@ extern int x;
 void *g = &x;
 int *h = &x;
 
-struct union_crash\r
-{\r
-    union\r
-    {\r
-    };\r
-};\r
+struct union_crash
+{
+    union
+    {
+    };
+};
 
 int test() {
   int a[10];