r183234 - Objective-C encoding. Fixes up encodeing for
Fariborz Jahanian
fjahanian at apple.com
Tue Jun 4 09:04:38 PDT 2013
Author: fjahanian
Date: Tue Jun 4 11:04:37 2013
New Revision: 183234
URL: http://llvm.org/viewvc/llvm-project?rev=183234&view=rev
Log:
Objective-C encoding. Fixes up encodeing for
arrays of empty structs. // rdar://14053082
(also pr13062).
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenObjC/encode-test.m
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=183234&r1=183233&r2=183234&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Jun 4 11:04:37 2013
@@ -5242,12 +5242,9 @@ void ASTContext::getObjCEncodingForTypeI
} 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!");
Modified: cfe/trunk/test/CodeGenObjC/encode-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test.m?rev=183234&r1=183233&r2=183234&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test.m Tue Jun 4 11:04:37 2013
@@ -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
More information about the cfe-commits
mailing list