Fix assertion hit when @encoding C++ classes. rdar://10172840 & http://llvm.org/PR10990

llvm-svn: 140542
This commit is contained in:
Argyrios Kyrtzidis 2011-09-26 18:14:24 +00:00
parent 7aa043afd9
commit 81c0b5c200
2 changed files with 23 additions and 2 deletions

View File

@ -4583,8 +4583,9 @@ void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
if (base->isEmpty())
continue;
uint64_t offs = layout.getVBaseClassOffsetInBits(base);
FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
std::make_pair(offs, base));
if (FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
std::make_pair(offs, base));
}
}

View File

@ -167,3 +167,23 @@ _Alloc_hider _M_dataplus;
// CHECK: @_ZL2g5 = internal constant [32 x i8] c"{basic_string={_Alloc_hider=*}}\00"
const char g5[] = @encode(basic_string);
// PR10990
class CefBase {
virtual ~CefBase() {}
};
class CefBrowser : public virtual CefBase {};
class CefBrowserImpl : public CefBrowser {};
// CHECK: @_ZL2g6 = internal constant [21 x i8] c"{CefBrowserImpl=^^?}\00"
const char g6[] = @encode(CefBrowserImpl);
// PR10990_2
class CefBase2 {
virtual ~CefBase2() {}
int i;
};
class CefBrowser2 : public virtual CefBase2 {};
class CefBrowserImpl2 : public CefBrowser2 {};
// CHECK: @_ZL2g7 = internal constant [26 x i8] c"{CefBrowserImpl2=^^?^^?i}\00"
const char g7[] = @encode(CefBrowserImpl2);