diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-09 00:49:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-09 00:49:46 +0000 |
commit | c25d7a7fe03d28163e4150d404fe34875e4283f2 (patch) | |
tree | d4432e462693d5e1a2aefc152a03f63f8f6283e5 /clang/lib/AST/DeclObjC.cpp | |
parent | 339153d3be566736ba431bda236c07b4f77f69c0 (diff) | |
download | bcm5719-llvm-c25d7a7fe03d28163e4150d404fe34875e4283f2.tar.gz bcm5719-llvm-c25d7a7fe03d28163e4150d404fe34875e4283f2.zip |
Addressed the issue in <rdar://problem/6479085>, where we failed to
rewrite @class declarations that showed up within linkage
specifications because those @class declarations never made it any
place where the rewriter could find them.
Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can
live in the appropriate top-level or transparent DeclContext near the
top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C
declarations now show up in a traversal of the declarations in a
DeclContext (they didn't before!). This way, the rewriter finds all
Objective-C declarations within linkage specifications.
llvm-svn: 61966
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index b7c0cf79b94..194544f9fa8 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -51,12 +51,13 @@ void ObjCMethodDecl::Destroy(ASTContext& C) { } ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C, + DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, SourceLocation ClassLoc, bool ForwardDecl, bool isInternal){ void *Mem = C.getAllocator().Allocate<ObjCInterfaceDecl>(); - return new (Mem) ObjCInterfaceDecl(atLoc, Id, ClassLoc, ForwardDecl, + return new (Mem) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, ForwardDecl, isInternal); } @@ -104,11 +105,11 @@ void ObjCAtDefsFieldDecl::Destroy(ASTContext& C) { C.getAllocator().Deallocate((void *)this); } -ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, +ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id) { void *Mem = C.getAllocator().Allocate<ObjCProtocolDecl>(); - return new (Mem) ObjCProtocolDecl(L, Id); + return new (Mem) ObjCProtocolDecl(DC, L, Id); } ObjCProtocolDecl::~ObjCProtocolDecl() { @@ -130,11 +131,11 @@ void ObjCProtocolDecl::Destroy(ASTContext& C) { } -ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, +ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, ObjCInterfaceDecl **Elts, unsigned nElts) { void *Mem = C.getAllocator().Allocate<ObjCClassDecl>(); - return new (Mem) ObjCClassDecl(L, Elts, nElts); + return new (Mem) ObjCClassDecl(DC, L, Elts, nElts); } ObjCClassDecl::~ObjCClassDecl() { @@ -155,58 +156,58 @@ void ObjCClassDecl::Destroy(ASTContext& C) { } ObjCForwardProtocolDecl * -ObjCForwardProtocolDecl::Create(ASTContext &C, +ObjCForwardProtocolDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, ObjCProtocolDecl **Elts, unsigned NumElts) { void *Mem = C.getAllocator().Allocate<ObjCForwardProtocolDecl>(); - return new (Mem) ObjCForwardProtocolDecl(L, Elts, NumElts); + return new (Mem) ObjCForwardProtocolDecl(DC, L, Elts, NumElts); } ObjCForwardProtocolDecl::~ObjCForwardProtocolDecl() { delete [] ReferencedProtocols; } -ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, +ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id) { void *Mem = C.getAllocator().Allocate<ObjCCategoryDecl>(); - return new (Mem) ObjCCategoryDecl(L, Id); + return new (Mem) ObjCCategoryDecl(DC, L, Id); } ObjCCategoryImplDecl * -ObjCCategoryImplDecl::Create(ASTContext &C, +ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,IdentifierInfo *Id, ObjCInterfaceDecl *ClassInterface) { void *Mem = C.getAllocator().Allocate<ObjCCategoryImplDecl>(); - return new (Mem) ObjCCategoryImplDecl(L, Id, ClassInterface); + return new (Mem) ObjCCategoryImplDecl(DC, L, Id, ClassInterface); } ObjCImplementationDecl * -ObjCImplementationDecl::Create(ASTContext &C, +ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *ClassInterface, ObjCInterfaceDecl *SuperDecl) { void *Mem = C.getAllocator().Allocate<ObjCImplementationDecl>(); - return new (Mem) ObjCImplementationDecl(L, Id, ClassInterface, SuperDecl); + return new (Mem) ObjCImplementationDecl(DC, L, Id, ClassInterface, SuperDecl); } ObjCCompatibleAliasDecl * -ObjCCompatibleAliasDecl::Create(ASTContext &C, +ObjCCompatibleAliasDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl* AliasedClass) { void *Mem = C.getAllocator().Allocate<ObjCCompatibleAliasDecl>(); - return new (Mem) ObjCCompatibleAliasDecl(L, Id, AliasedClass); + return new (Mem) ObjCCompatibleAliasDecl(DC, L, Id, AliasedClass); } -ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C, +ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, PropertyControl propControl) { void *Mem = C.getAllocator().Allocate<ObjCPropertyDecl>(); - return new (Mem) ObjCPropertyDecl(L, Id, T); + return new (Mem) ObjCPropertyDecl(DC, L, Id, T); } //===----------------------------------------------------------------------===// @@ -757,13 +758,14 @@ ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() { } ObjCPropertyImplDecl *ObjCPropertyImplDecl::Create(ASTContext &C, + DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivar) { void *Mem = C.getAllocator().Allocate<ObjCPropertyImplDecl>(); - return new (Mem) ObjCPropertyImplDecl(atLoc, L, property, PK, ivar); + return new (Mem) ObjCPropertyImplDecl(DC, atLoc, L, property, PK, ivar); } |