summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Hunt <whunt@google.com>2013-12-07 00:15:04 +0000
committerWarren Hunt <whunt@google.com>2013-12-07 00:15:04 +0000
commit4aafaee7df9a3181fbf20531c3dbe3a81985cd03 (patch)
tree56439df8493921dcda8576240eec5b200822a58c
parent4e8656077c1478ecb74527cd1add5b22319dd202 (diff)
downloadbcm5719-llvm-4aafaee7df9a3181fbf20531c3dbe3a81985cd03.tar.gz
bcm5719-llvm-4aafaee7df9a3181fbf20531c3dbe3a81985cd03.zip
Fixing assertion failure introduced in 196602.
Also includes a minor refactor with no functional change. llvm-svn: 196627
-rw-r--r--clang/include/clang/AST/RecordLayout.h3
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp10
2 files changed, 5 insertions, 8 deletions
diff --git a/clang/include/clang/AST/RecordLayout.h b/clang/include/clang/AST/RecordLayout.h
index 1eae8c057ca..ca107180449 100644
--- a/clang/include/clang/AST/RecordLayout.h
+++ b/clang/include/clang/AST/RecordLayout.h
@@ -283,8 +283,7 @@ public:
}
bool hasZeroSizedSubObject() const {
- assert(CXXInfo && "Record layout does not have C++ specific info!");
- return CXXInfo->HasZeroSizedSubObject;
+ return CXXInfo && CXXInfo->HasZeroSizedSubObject;
}
bool leadsWithZeroSizedBase() const {
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index b692025aa0f..a3ea6b9f386 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -2590,15 +2590,13 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBase(const CXXRecordDecl *RD,
// vtordisps are always 4 bytes (even in 64-bit mode)
if (HasVtordisp)
Size = Size.RoundUpToAlignment(Alignment) + CharUnits::fromQuantity(4);
- Size = Size.RoundUpToAlignment(BaseAlign);
// Insert the base here.
- CharUnits BaseOffset = Size.RoundUpToAlignment(BaseAlign);
+ Size = Size.RoundUpToAlignment(BaseAlign);
VBases.insert(
- std::make_pair(RD, ASTRecordLayout::VBaseInfo(BaseOffset, HasVtordisp)));
- Size = BaseOffset + BaseNVSize;
- // Note: we don't update alignment here because it was accounted for in
- // InitializeLayout.
+ std::make_pair(RD, ASTRecordLayout::VBaseInfo(Size, HasVtordisp)));
+ Size += BaseNVSize;
+ // Alignment was upadated in InitializeCXXLayout.
PreviousBaseLayout = &Layout;
}
OpenPOWER on IntegriCloud