From: Chris Lattner Date: Mon, 23 Jul 2007 22:46:22 +0000 (+0000) Subject: fix bogus warnings about potentially uninit vars Size and Align. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc0d73e6495404418acf8548875aeaff07791a74;p=clang fix bogus warnings about potentially uninit vars Size and Align. Patch by Neil Booth! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40452 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index 3e1f32ded8..a9fb81faad 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -227,14 +227,14 @@ ASTContext::getTypeInfo(QualType T, SourceLocation L) { break; } case Type::Tagged: - if (RecordType *RT = dyn_cast(cast(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(cast(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");