summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7ff4ae91654..fa3139c5000 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1485,6 +1485,11 @@ void ASTContext::getObjCEncodingForType(QualType T, std::string& S,
S += '?';
} else if (const RecordType *RTy = T->getAsRecordType()) {
RecordDecl *RDecl= RTy->getDecl();
+ // This mimics the behavior in gcc's encode_aggregate_within().
+ // The idea is to only inline structure definitions for top level pointers
+ // to structures and embedded structures.
+ bool inlining = (S.size() == 1 && S[0] == '^' ||
+ S.size() > 1 && S[S.size()-1] != '^');
S += '{';
S += RDecl->getName();
bool found = false;
@@ -1493,7 +1498,7 @@ void ASTContext::getObjCEncodingForType(QualType T, std::string& S,
found = true;
break;
}
- if (!found) {
+ if (!found && inlining) {
ERType.push_back(RTy);
S += '=';
for (int i = 0; i < RDecl->getNumMembers(); i++) {
OpenPOWER on IntegriCloud