summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-07-12 16:19:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-07-12 16:19:11 +0000
commit88890e7b50e71cfec91e7daa44bed359fc947288 (patch)
treebf74b13a120a78e663f50b6743a6e64ddd4c5ed5 /clang/lib/AST
parent41eec7e475f4c72426e56b663a44c60a2daf839d (diff)
downloadbcm5719-llvm-88890e7b50e71cfec91e7daa44bed359fc947288.tar.gz
bcm5719-llvm-88890e7b50e71cfec91e7daa44bed359fc947288.zip
Objective-C: Produce gcc compatible encoding of
ivar type in meta-data while preventing recursive encoding in a corner case. // rdar://14408244 llvm-svn: 186169
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 933e5e057ee..527a6477018 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -5434,6 +5434,20 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
// We encode the underlying type which comes out as
// {...};
S += '^';
+ if (FD && OPT->getInterfaceDecl()) {
+ // Prevent redursive encoding of fields in some rare cases.
+ ObjCInterfaceDecl *OI = OPT->getInterfaceDecl();
+ SmallVector<const ObjCIvarDecl*, 32> Ivars;
+ DeepCollectObjCIvars(OI, true, Ivars);
+ for (unsigned i = 0, e = Ivars.size(); i != e; ++i) {
+ if (cast<FieldDecl>(Ivars[i]) == FD) {
+ S += '{';
+ S += OI->getIdentifier()->getName();
+ S += '}';
+ return;
+ }
+ }
+ }
getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
NULL,
OpenPOWER on IntegriCloud