summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp3
-rw-r--r--clang/lib/AST/Decl.cpp30
-rw-r--r--clang/lib/AST/DeclObjC.cpp5
-rw-r--r--clang/lib/AST/DeclSerialization.cpp6
-rw-r--r--clang/lib/Sema/Sema.cpp3
-rw-r--r--clang/lib/Sema/Sema.h8
-rw-r--r--clang/lib/Sema/SemaDecl.cpp18
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp2
8 files changed, 36 insertions, 39 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 9e51b292fb3..0708c704c5c 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1131,8 +1131,7 @@ QualType ASTContext::getCFConstantStringType() {
FieldDecl *FieldDecls[4];
for (unsigned i = 0; i < 4; ++i)
- FieldDecls[i] = FieldDecl::Create(*this, CFConstantStringTypeDecl,
- SourceLocation(), 0,
+ FieldDecls[i] = FieldDecl::Create(*this, SourceLocation(), 0,
FieldTypes[i]);
CFConstantStringTypeDecl->defineBody(FieldDecls, 4);
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index b1a2499949c..d97e0b33e5c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -204,7 +204,7 @@ void Decl::addDeclKind(Kind k) {
// Decl Allocation/Deallocation Method Implementations
//===----------------------------------------------------------------------===//
-BlockVarDecl *BlockVarDecl::Create(ASTContext &C, ContextDecl *CD,
+BlockVarDecl *BlockVarDecl::Create(ASTContext &C, DeclContext *CD,
SourceLocation L,
IdentifierInfo *Id, QualType T,
StorageClass S, ScopedDecl *PrevDecl) {
@@ -213,7 +213,7 @@ BlockVarDecl *BlockVarDecl::Create(ASTContext &C, ContextDecl *CD,
}
-FileVarDecl *FileVarDecl::Create(ASTContext &C, ContextDecl *CD,
+FileVarDecl *FileVarDecl::Create(ASTContext &C, DeclContext *CD,
SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass S,
ScopedDecl *PrevDecl) {
@@ -221,7 +221,7 @@ FileVarDecl *FileVarDecl::Create(ASTContext &C, ContextDecl *CD,
return new (Mem) FileVarDecl(CD, L, Id, T, S, PrevDecl);
}
-ParmVarDecl *ParmVarDecl::Create(ASTContext &C, ContextDecl *CD,
+ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *CD,
SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass S,
ScopedDecl *PrevDecl) {
@@ -229,7 +229,7 @@ ParmVarDecl *ParmVarDecl::Create(ASTContext &C, ContextDecl *CD,
return new (Mem) ParmVarDecl(CD, L, Id, T, S, PrevDecl);
}
-FunctionDecl *FunctionDecl::Create(ASTContext &C, ContextDecl *CD,
+FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *CD,
SourceLocation L,
IdentifierInfo *Id, QualType T,
StorageClass S, bool isInline,
@@ -238,10 +238,10 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, ContextDecl *CD,
return new (Mem) FunctionDecl(CD, L, Id, T, S, isInline, PrevDecl);
}
-FieldDecl *FieldDecl::Create(ASTContext &C, RecordDecl *CD, SourceLocation L,
+FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L,
IdentifierInfo *Id, QualType T, Expr *BW) {
void *Mem = C.getAllocator().Allocate<FieldDecl>();
- return new (Mem) FieldDecl(CD, L, Id, T, BW);
+ return new (Mem) FieldDecl(L, Id, T, BW);
}
@@ -254,7 +254,7 @@ EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, EnumDecl *CD,
return new (Mem) EnumConstantDecl(CD, L, Id, T, E, V, PrevDecl);
}
-TypedefDecl *TypedefDecl::Create(ASTContext &C, ContextDecl *CD,
+TypedefDecl *TypedefDecl::Create(ASTContext &C, DeclContext *CD,
SourceLocation L,
IdentifierInfo *Id, QualType T,
ScopedDecl *PD) {
@@ -262,14 +262,14 @@ TypedefDecl *TypedefDecl::Create(ASTContext &C, ContextDecl *CD,
return new (Mem) TypedefDecl(CD, L, Id, T, PD);
}
-EnumDecl *EnumDecl::Create(ASTContext &C, ContextDecl *CD, SourceLocation L,
+EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *CD, SourceLocation L,
IdentifierInfo *Id,
ScopedDecl *PrevDecl) {
void *Mem = C.getAllocator().Allocate<EnumDecl>();
return new (Mem) EnumDecl(CD, L, Id, PrevDecl);
}
-RecordDecl *RecordDecl::Create(ASTContext &C, Kind DK, ContextDecl *CD,
+RecordDecl *RecordDecl::Create(ASTContext &C, Kind DK, DeclContext *CD,
SourceLocation L, IdentifierInfo *Id,
ScopedDecl *PrevDecl) {
void *Mem = C.getAllocator().Allocate<RecordDecl>();
@@ -330,22 +330,22 @@ const Attr *Decl::getAttrs() const {
}
//===----------------------------------------------------------------------===//
-// ContextDecl Implementation
+// DeclContext Implementation
//===----------------------------------------------------------------------===//
-ContextDecl *ContextDecl::getParent() const {
+DeclContext *DeclContext::getParent() const {
if (ScopedDecl *SD = dyn_cast<ScopedDecl>(this))
- return SD->getContextDecl();
+ return SD->getDeclContext();
else
return NULL;
}
-Decl *ContextDecl::ToDecl (const ContextDecl *D) {
+Decl *DeclContext::ToDecl (const DeclContext *D) {
return CastTo<Decl>(D);
}
-ContextDecl *ContextDecl::FromDecl (const Decl *D) {
- return CastTo<ContextDecl>(D);
+DeclContext *DeclContext::FromDecl (const Decl *D) {
+ return CastTo<DeclContext>(D);
}
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 5671dbe9b94..a8ef5aa473b 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -45,11 +45,10 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
isInternal);
}
-ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCInterfaceDecl *CD,
- SourceLocation L,
+ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, SourceLocation L,
IdentifierInfo *Id, QualType T) {
void *Mem = C.getAllocator().Allocate<ObjCIvarDecl>();
- return new (Mem) ObjCIvarDecl(CD, L, Id, T);
+ return new (Mem) ObjCIvarDecl(L, Id, T);
}
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C,
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp
index e6b3f93096c..a2e9ce1b121 100644
--- a/clang/lib/AST/DeclSerialization.cpp
+++ b/clang/lib/AST/DeclSerialization.cpp
@@ -106,7 +106,7 @@ void NamedDecl::ReadInRec(Deserializer& D) {
void ScopedDecl::EmitInRec(Serializer& S) const {
NamedDecl::EmitInRec(S);
S.EmitPtr(getNext()); // From ScopedDecl.
- S.EmitPtr(cast_or_null<Decl>(getContextDecl())); // From ScopedDecl.
+ S.EmitPtr(cast_or_null<Decl>(getDeclContext())); // From ScopedDecl.
}
void ScopedDecl::ReadInRec(Deserializer& D) {
@@ -114,7 +114,7 @@ void ScopedDecl::ReadInRec(Deserializer& D) {
D.ReadPtr(Next); // From ScopedDecl.
Decl *TmpD;
D.ReadPtr(TmpD); // From ScopedDecl.
- CtxDecl = cast_or_null<ContextDecl>(TmpD);
+ CtxDecl = cast_or_null<DeclContext>(TmpD);
}
//===------------------------------------------------------------===//
@@ -306,7 +306,7 @@ void FieldDecl::EmitImpl(Serializer& S) const {
}
FieldDecl* FieldDecl::CreateImpl(Deserializer& D) {
- FieldDecl* decl = new FieldDecl(0, SourceLocation(), NULL, QualType(), 0);
+ FieldDecl* decl = new FieldDecl(SourceLocation(), NULL, QualType(), 0);
decl->DeclType.ReadBackpatch(D);
decl->ReadInRec(D);
decl->BitWidth = D.ReadOwnedPtr<Expr>();
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 9e379e4be74..8c9bceae210 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -120,8 +120,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
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/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index b1d0499d137..98ecf87ce66 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -32,7 +32,7 @@ namespace clang {
class ASTConsumer;
class Preprocessor;
class Decl;
- class ContextDecl;
+ class DeclContext;
class NamedDecl;
class ScopedDecl;
class Expr;
@@ -75,7 +75,7 @@ class Sema : public Action {
/// 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 @@ private:
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/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 882ec0e1a44..150478c1e79 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -40,14 +40,14 @@ Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) {
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 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
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 @@ Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtTy *Body) {
MD->setBody((Stmt*)Body);
CurMethodDecl = 0;
}
- PopContextDecl();
+ PopDeclContext();
// Verify and clean out per-function state.
// Check goto/label use.
@@ -1353,8 +1353,8 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *tagDecl,
// 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 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *tagDecl,
// 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/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 6b9b9e2d431..9cf1b3c4259 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -33,7 +33,7 @@ void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
// 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.
OpenPOWER on IntegriCloud