[cfe-commits] r40452 - /cfe/trunk/AST/ASTContext.cpp

Chris Lattner sabre at nondot.org
Mon Jul 23 15:46:22 PDT 2007


Author: lattner
Date: Mon Jul 23 17:46:22 2007
New Revision: 40452

URL: http://llvm.org/viewvc/llvm-project?rev=40452&view=rev
Log:
fix bogus warnings about potentially uninit vars Size and Align.

Patch by Neil Booth!

Modified:
    cfe/trunk/AST/ASTContext.cpp

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=40452&r1=40451&r2=40452&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Jul 23 17:46:22 2007
@@ -227,14 +227,14 @@
     break;
   }
   case Type::Tagged:
-    if (RecordType *RT = dyn_cast<RecordType>(cast<TagType>(T))) {
-      const RecordLayout &Layout = getRecordLayout(RT->getDecl(), L);
-      Size = Layout.getSize();
-      Align = Layout.getAlignment();
-      break;
-    }
-    // FIXME: Handle enums.
-    assert(0 && "Unimplemented type sizes!");
+    RecordType *RT = dyn_cast<RecordType>(cast<TagType>(T));
+    if (!RT)
+      // FIXME: Handle enums.
+      assert(0 && "Unimplemented type sizes!");
+    const RecordLayout &Layout = getRecordLayout(RT->getDecl(), L);
+    Size = Layout.getSize();
+    Align = Layout.getAlignment();
+    break;
   }
   
   assert(Align && (Align & (Align-1)) == 0 && "Alignment must be power of 2");





More information about the cfe-commits mailing list