]> granicus.if.org Git - clang/commitdiff
Explicitly initialize the PrimaryBase and PrimaryBaseWasVirtual members.
authorAnders Carlsson <andersca@mac.com>
Tue, 22 Sep 2009 18:21:58 +0000 (18:21 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 22 Sep 2009 18:21:58 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82560 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp

index 3669db65ca75abb0c94a0e8afe84badc3006baac..836e43c43afc8c2f5a4e2b302e449b265a64691a 100644 (file)
@@ -23,13 +23,13 @@ using namespace clang;
 
 ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx)
   : Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0),
-  NextOffset(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8) {}
+  NextOffset(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8),
+  PrimaryBase(0), PrimaryBaseWasVirtual(false) {}
 
 /// LayoutVtable - Lay out the vtable and set PrimaryBase.
 void ASTRecordLayoutBuilder::LayoutVtable(const CXXRecordDecl *RD) {
   if (!RD->isDynamicClass()) {
     // There is no primary base in this case.
-    setPrimaryBase(0, false);
     return;
   }
 
@@ -149,10 +149,8 @@ void ASTRecordLayoutBuilder::SelectPrimaryBase(const CXXRecordDecl *RD) {
 
   // If we have no virtual bases at this point, bail out as the searching below
   // is expensive.
-  if (RD->getNumVBases() == 0) {
-    setPrimaryBase(0, false);
+  if (RD->getNumVBases() == 0)
     return;
-  }
   
   // Then we can search for the first nearly empty virtual base itself.
   const CXXRecordDecl *FirstPrimary = 0;