Introduce ContextDecl, patch by Argiris Kirtzidis!
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49208 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 2e3a06a..a01c304 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -19,7 +19,8 @@
// ObjC Decl Allocation/Deallocation Method Implementations
//===----------------------------------------------------------------------===//
-ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C, SourceLocation beginLoc,
+ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
+ SourceLocation beginLoc,
SourceLocation endLoc,
Selector SelInfo, QualType T,
Decl *contextDecl,
@@ -27,61 +28,71 @@
bool isVariadic,
ImplementationControl impControl) {
void *Mem = C.getAllocator().Allocate<ObjCMethodDecl>();
- return new (Mem) ObjCMethodDecl(beginLoc, endLoc, SelInfo, T, contextDecl,
+ return new (Mem) ObjCMethodDecl(beginLoc, endLoc,
+ SelInfo, T, contextDecl,
M, isInstance,
isVariadic, impControl);
}
-ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,SourceLocation atLoc,
+ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
+ SourceLocation atLoc,
unsigned numRefProtos,
IdentifierInfo *Id,
bool ForwardDecl, bool isInternal){
void *Mem = C.getAllocator().Allocate<ObjCInterfaceDecl>();
- return new (Mem) ObjCInterfaceDecl(atLoc, numRefProtos, Id, ForwardDecl,
+ return new (Mem) ObjCInterfaceDecl(atLoc, numRefProtos,
+ Id, ForwardDecl,
isInternal);
}
-ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, SourceLocation L,
+ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCInterfaceDecl *CD,
+ SourceLocation L,
IdentifierInfo *Id, QualType T) {
void *Mem = C.getAllocator().Allocate<ObjCIvarDecl>();
- return new (Mem) ObjCIvarDecl(L, Id, T);
+ return new (Mem) ObjCIvarDecl(CD, L, Id, T);
}
-ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, SourceLocation L,
+ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C,
+ SourceLocation L,
unsigned numRefProtos,
IdentifierInfo *Id) {
void *Mem = C.getAllocator().Allocate<ObjCProtocolDecl>();
return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id);
}
-ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, SourceLocation L,
+ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C,
+ SourceLocation L,
ObjCInterfaceDecl **Elts, unsigned nElts) {
void *Mem = C.getAllocator().Allocate<ObjCClassDecl>();
return new (Mem) ObjCClassDecl(L, Elts, nElts);
}
ObjCForwardProtocolDecl *
-ObjCForwardProtocolDecl::Create(ASTContext &C, SourceLocation L,
+ObjCForwardProtocolDecl::Create(ASTContext &C,
+ SourceLocation L,
ObjCProtocolDecl **Elts, unsigned NumElts) {
void *Mem = C.getAllocator().Allocate<ObjCForwardProtocolDecl>();
return new (Mem) ObjCForwardProtocolDecl(L, Elts, NumElts);
}
-ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, SourceLocation L,
+ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C,
+ SourceLocation L,
IdentifierInfo *Id) {
void *Mem = C.getAllocator().Allocate<ObjCCategoryDecl>();
return new (Mem) ObjCCategoryDecl(L, Id);
}
ObjCCategoryImplDecl *
-ObjCCategoryImplDecl::Create(ASTContext &C, SourceLocation L,IdentifierInfo *Id,
+ObjCCategoryImplDecl::Create(ASTContext &C,
+ SourceLocation L,IdentifierInfo *Id,
ObjCInterfaceDecl *ClassInterface) {
void *Mem = C.getAllocator().Allocate<ObjCCategoryImplDecl>();
return new (Mem) ObjCCategoryImplDecl(L, Id, ClassInterface);
}
ObjCImplementationDecl *
-ObjCImplementationDecl::Create(ASTContext &C, SourceLocation L,
+ObjCImplementationDecl::Create(ASTContext &C,
+ SourceLocation L,
IdentifierInfo *Id,
ObjCInterfaceDecl *ClassInterface,
ObjCInterfaceDecl *SuperDecl) {
@@ -90,14 +101,16 @@
}
ObjCCompatibleAliasDecl *
-ObjCCompatibleAliasDecl::Create(ASTContext &C, SourceLocation L,
+ObjCCompatibleAliasDecl::Create(ASTContext &C,
+ SourceLocation L,
IdentifierInfo *Id,
ObjCInterfaceDecl* AliasedClass) {
void *Mem = C.getAllocator().Allocate<ObjCCompatibleAliasDecl>();
return new (Mem) ObjCCompatibleAliasDecl(L, Id, AliasedClass);
}
-ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C, SourceLocation L) {
+ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C,
+ SourceLocation L) {
void *Mem = C.getAllocator().Allocate<ObjCPropertyDecl>();
return new (Mem) ObjCPropertyDecl(L);
}
@@ -431,3 +444,4 @@
}
+