[cfe-commits] r138235 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjCXX/encode.mm
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Aug 22 09:03:14 PDT 2011
Author: akirtzidis
Date: Mon Aug 22 11:03:14 2011
New Revision: 138235
URL: http://llvm.org/viewvc/llvm-project?rev=138235&view=rev
Log:
Fix a bug in objc @encoding of C++ classes.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenObjCXX/encode.mm
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=138235&r1=138234&r2=138235&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Aug 22 11:03:14 2011
@@ -4565,7 +4565,9 @@
std::multimap<uint64_t, NamedDecl *>::iterator
CurLayObj = FieldOrBaseOffsets.begin();
- if (CurLayObj != FieldOrBaseOffsets.end() && CurLayObj->first != 0) {
+ if ((CurLayObj != FieldOrBaseOffsets.end() && CurLayObj->first != 0) ||
+ (CurLayObj == FieldOrBaseOffsets.end() &&
+ CXXRec && CXXRec->isDynamicClass())) {
assert(CXXRec && CXXRec->isDynamicClass() &&
"Offset 0 was empty but no VTable ?");
if (FD) {
Modified: cfe/trunk/test/CodeGenObjCXX/encode.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/encode.mm?rev=138235&r1=138234&r2=138235&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/encode.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/encode.mm Mon Aug 22 11:03:14 2011
@@ -105,6 +105,27 @@
const char g2[] = @encode(S2);
}
+namespace test {
+ class Foo {
+ public:
+ virtual void f() {};
+ };
+
+ class Bar {
+ public:
+ virtual void g() {};
+ };
+
+ class Zoo : virtual public Foo, virtual public Bar {
+ public:
+ int x;
+ int y;
+ };
+
+ // CHECK: @_ZN4testL3ecdE = internal constant [15 x i8] c"{Zoo=^^?ii^^?}\00"
+ const char ecd[] = @encode(Zoo);
+}
+
struct Base1 {
char x;
};
More information about the cfe-commits
mailing list