forked from OSchip/llvm-project
Objective-C encoding. Fixes up encodeing for
arrays of empty structs. // rdar://14053082 (also pr13062). llvm-svn: 183234
This commit is contained in:
parent
6f0a5edb3f
commit
f0dc11ad7f
|
@ -5242,12 +5242,9 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
|
|||
} else {
|
||||
S += '[';
|
||||
|
||||
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT)) {
|
||||
if (getTypeSize(CAT->getElementType()) == 0)
|
||||
S += '0';
|
||||
else
|
||||
S += llvm::utostr(CAT->getSize().getZExtValue());
|
||||
} else {
|
||||
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
|
||||
S += llvm::utostr(CAT->getSize().getZExtValue());
|
||||
else {
|
||||
//Variable length arrays are encoded as a regular array with 0 elements.
|
||||
assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
|
||||
"Unknown array type!");
|
||||
|
|
|
@ -159,7 +159,7 @@ struct f
|
|||
int tt;
|
||||
};
|
||||
|
||||
// CHECK: @g10 = constant [14 x i8] c"{f=i[0{?=}]i}\00"
|
||||
// CHECK: @g10 = constant [14 x i8] c"{f=i[4{?=}]i}\00"
|
||||
const char g10[] = @encode(struct f);
|
||||
|
||||
// rdar://9622422
|
||||
|
|
Loading…
Reference in New Issue