This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl
Patch by Argiris Kirtzidis!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49261 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 9e379e4..8c9bcea 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -120,8 +120,7 @@
RecordDecl::Create(Context, Decl::Struct, NULL,
SourceLocation(),
&IT.get("objc_object"), 0);
- FieldDecl *IsaDecl = FieldDecl::Create(Context, ObjectTag,
- SourceLocation(), 0,
+ FieldDecl *IsaDecl = FieldDecl::Create(Context, SourceLocation(), 0,
Context.getObjCClassType());
ObjectTag->defineBody(&IsaDecl, 1);
QualType ObjT = Context.getPointerType(Context.getTagDeclType(ObjectTag));
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index b1d0499..98ecf87 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -32,7 +32,7 @@
class ASTConsumer;
class Preprocessor;
class Decl;
- class ContextDecl;
+ class DeclContext;
class NamedDecl;
class ScopedDecl;
class Expr;
@@ -75,7 +75,7 @@
/// the method decl for the method being parsed.
ObjCMethodDecl *CurMethodDecl;
- ContextDecl *CurContext;
+ DeclContext *CurContext;
/// LabelMap - This is a mapping from label identifiers to the LabelStmt for
/// it (which acts like the label decl in some ways). Forward referenced
@@ -250,8 +250,8 @@
DeclTy **Elements, unsigned NumElements);
private:
/// Set the current declaration context until it gets popped.
- void PushContextDecl(ContextDecl *CD);
- void PopContextDecl();
+ void PushDeclContext(DeclContext *CD);
+ void PopDeclContext();
/// Subroutines of ActOnDeclarator().
TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 882ec0e..150478c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -40,14 +40,14 @@
return 0;
}
-void Sema::PushContextDecl(ContextDecl *CD) {
+void Sema::PushDeclContext(DeclContext *CD) {
assert(CD->getParent() == CurContext &&
- "The next ContextDecl should be directly contained in the current one.");
+ "The next DeclContext should be directly contained in the current one.");
CurContext = CD;
}
-void Sema::PopContextDecl() {
- assert(CurContext && "ContextDecl imbalance!");
+void Sema::PopDeclContext() {
+ assert(CurContext && "DeclContext imbalance!");
CurContext = CurContext->getParent();
}
@@ -1081,7 +1081,7 @@
Decl *decl = static_cast<Decl*>(ActOnDeclarator(GlobalScope, D, 0));
FunctionDecl *FD = cast<FunctionDecl>(decl);
CurFunctionDecl = FD;
- PushContextDecl(FD);
+ PushDeclContext(FD);
// Create Decl objects for each parameter, adding them to the FunctionDecl.
llvm::SmallVector<ParmVarDecl*, 16> Params;
@@ -1126,7 +1126,7 @@
MD->setBody((Stmt*)Body);
CurMethodDecl = 0;
}
- PopContextDecl();
+ PopDeclContext();
// Verify and clean out per-function state.
// Check goto/label use.
@@ -1353,8 +1353,8 @@
// FIXME: Chain fielddecls together.
FieldDecl *NewFD;
- if (RecordDecl *RD = dyn_cast<RecordDecl>(TagDecl))
- NewFD = FieldDecl::Create(Context, RD, Loc, II, T, BitWidth);
+ if (isa<RecordDecl>(TagDecl))
+ NewFD = FieldDecl::Create(Context, Loc, II, T, BitWidth);
else if (isa<ObjCInterfaceDecl>(TagDecl) ||
isa<ObjCImplementationDecl>(TagDecl) ||
isa<ObjCCategoryDecl>(TagDecl) ||
@@ -1362,7 +1362,7 @@
// properties can appear within a protocol.
// See corresponding FIXME in DeclObjC.h:ObjCPropertyDecl.
isa<ObjCProtocolDecl>(TagDecl))
- NewFD = ObjCIvarDecl::Create(Context, dyn_cast<ObjCInterfaceDecl>(TagDecl), Loc, II, T);
+ NewFD = ObjCIvarDecl::Create(Context, Loc, II, T);
else
assert(0 && "Sema::ActOnField(): Unknown TagDecl");
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 6b9b9e2..9cf1b3c 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -33,7 +33,7 @@
// Allow all of Sema to see that we are entering a method definition.
CurMethodDecl = MDecl;
- PushContextDecl(MDecl);
+ PushDeclContext(MDecl);
// Create Decl objects for each parameter, entrring them in the scope for
// binding to their use.