]> granicus.if.org Git - clang/commit
Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 14 May 2011 20:32:43 +0000 (20:32 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 14 May 2011 20:32:43 +0000 (20:32 +0000)
commit02c5116db6a40e806534c416e0abb22b8840831e
tree8fe93654bd2f7c2da0f51ce5e6a7b80f66f65a53
parent3b5904ba83fc9b968b1cd6f1ce78d01bfd6e8686
Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.

Go through and expand the members of bases into the encoding string (and encode the VTable as well).
Unlike gcc which expands virtual bases as many times as they appear in the
hierarchy, clang will only expand them once at the end, to reflect the actual layout.

Note that there doesn't seem to be a way to indicate in the encoding that
packing/alignment of members is different that normal, in which case
the encoding will be out-of-sync with the real layout.
If the runtime switches to just consider the size of types without
taking into account alignment, we could easily make padding explicit in the
encoding (e.g. using arrays of chars). The encoding strings would be
longer then though.

Also encode a flexible array member as array of 0 size, like gcc, not as a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131365 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp
test/CodeGenObjC/encode-test.m
test/CodeGenObjCXX/encode.mm