summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclObjC.h4
-rw-r--r--clang/lib/AST/DeclObjC.cpp4
-rw-r--r--clang/test/Rewriter/rewrite-super-message.mm13
3 files changed, 20 insertions, 1 deletions
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index a6f60f383ec..34fd4d71e73 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -814,7 +814,9 @@ public:
}
void setSuperClass(ObjCInterfaceDecl * superCls) {
- data().SuperClass = superCls;
+ data().SuperClass =
+ (superCls && superCls->hasDefinition()) ? superCls->getDefinition()
+ : superCls;
}
ObjCCategoryDecl* getCategoryList() const {
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 2960b13d6de..a204e45bac9 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -1112,6 +1112,8 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation nameLoc,
SourceLocation atStartLoc,
SourceLocation CategoryNameLoc) {
+ if (ClassInterface && ClassInterface->hasDefinition())
+ ClassInterface = ClassInterface->getDefinition();
return new (C) ObjCCategoryImplDecl(DC, Id, ClassInterface,
nameLoc, atStartLoc, CategoryNameLoc);
}
@@ -1196,6 +1198,8 @@ ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
ObjCInterfaceDecl *SuperDecl,
SourceLocation nameLoc,
SourceLocation atStartLoc) {
+ if (ClassInterface && ClassInterface->hasDefinition())
+ ClassInterface = ClassInterface->getDefinition();
return new (C) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
nameLoc, atStartLoc);
}
diff --git a/clang/test/Rewriter/rewrite-super-message.mm b/clang/test/Rewriter/rewrite-super-message.mm
index 2def2808346..c7401378422 100644
--- a/clang/test/Rewriter/rewrite-super-message.mm
+++ b/clang/test/Rewriter/rewrite-super-message.mm
@@ -36,3 +36,16 @@ void *sel_registerName(const char *);
return [super allocWithZone:zone];
}
@end
+
+@interface XNSArray
+{
+ Class isa;
+}
+@end
+
+@class XNSArray;
+
+@interface __NSArray0 : XNSArray
+@end
+
+@implementation __NSArray0 @end
OpenPOWER on IntegriCloud