]> granicus.if.org Git - clang/commitdiff
fix bogus warnings about potentially uninit vars Size and Align.
authorChris Lattner <sabre@nondot.org>
Mon, 23 Jul 2007 22:46:22 +0000 (22:46 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 23 Jul 2007 22:46:22 +0000 (22:46 +0000)
Patch by Neil Booth!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40452 91177308-0d34-0410-b5e6-96231b3b80d8

AST/ASTContext.cpp

index 3e1f32ded8a206c47fb14024f8dbad937d77a931..a9fb81faad817109afc7f320eb7b82f449133da3 100644 (file)
@@ -227,14 +227,14 @@ ASTContext::getTypeInfo(QualType T, SourceLocation L) {
     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");