summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp6
-rw-r--r--clang/lib/AST/DeclBase.cpp11
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp12
-rw-r--r--clang/lib/Sema/SemaDecl.cpp10
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp10
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp36
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp2
7 files changed, 41 insertions, 46 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 988fa1a5c3a..24172a5ddbd 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -533,7 +533,7 @@ const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D)
RecFields[i]->getIdentifier(),
RecFields[i]->getType(),
RecFields[i]->getBitWidth(), false, 0);
- NewRD->addDecl(*this, Field);
+ NewRD->addDecl(Field);
}
NewRD->completeDefinition(*this);
RD = NewRD;
@@ -1554,7 +1554,7 @@ QualType ASTContext::getCFConstantStringType() {
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false, /*PrevDecl=*/0);
- CFConstantStringTypeDecl->addDecl(*this, Field, true);
+ CFConstantStringTypeDecl->addDecl(Field);
}
CFConstantStringTypeDecl->completeDefinition(*this);
@@ -1584,7 +1584,7 @@ QualType ASTContext::getObjCFastEnumerationStateType()
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false, /*PrevDecl=*/0);
- ObjCFastEnumerationStateTypeDecl->addDecl(*this, Field, true);
+ ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index cafe5358d61..8eb52b722d4 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -514,7 +514,7 @@ DeclContext *DeclContext::getNextContext() {
}
}
-void DeclContext::addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup) {
+void DeclContext::addDecl(ScopedDecl *D) {
assert(D->getLexicalDeclContext() == this && "Decl inserted into wrong lexical context");
assert(!D->NextDeclInScope && D != LastDecl &&
"Decl already inserted into a DeclContext");
@@ -525,8 +525,7 @@ void DeclContext::addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup)
} else {
FirstDecl = LastDecl = D;
}
- if (AllowLookup)
- D->getDeclContext()->insert(Context, D);
+ D->getDeclContext()->insert(D);
}
/// buildLookup - Build the lookup data structure with all of the
@@ -596,10 +595,10 @@ const DeclContext *DeclContext::getLookupContext() const {
return Ctx;
}
-void DeclContext::insert(ASTContext &Context, ScopedDecl *D) {
+void DeclContext::insert(ScopedDecl *D) {
DeclContext *PrimaryContext = getPrimaryContext();
if (PrimaryContext != this) {
- PrimaryContext->insert(Context, D);
+ PrimaryContext->insert(D);
return;
}
@@ -612,7 +611,7 @@ void DeclContext::insert(ASTContext &Context, ScopedDecl *D) {
// If we are a transparent context, insert into our parent context,
// too. This operation is recursive.
if (isTransparentContext())
- getParent()->insert(Context, D);
+ getParent()->insert(D);
}
void DeclContext::insertImpl(ScopedDecl *D) {
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index c587ab82303..0a8aa45b2d7 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -2376,14 +2376,10 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct, 0,
SourceLocation(),
&Ctx.Idents.get("_objc_super"));
- RD->addDecl(Ctx,
- FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.getObjCIdType(), 0, false, 0),
- true);
- RD->addDecl(Ctx,
- FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.getObjCClassType(), 0, false, 0),
- true);
+ RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.getObjCIdType(), 0, false, 0));
+ RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.getObjCClassType(), 0, false, 0));
RD->completeDefinition(Ctx);
SuperCTy = Ctx.getTagDeclType(RD);
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6aeda8bc0b5..9b419e5b63c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -106,7 +106,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S) {
// found later. Declarations without a context won't be inserted
// into any context.
if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D))
- CurContext->addDecl(Context, SD);
+ CurContext->addDecl(SD);
// C++ [basic.scope]p4:
// -- exactly one declaration shall declare a class name or
@@ -931,7 +931,7 @@ bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner,
// definition, the members of the anonymous union are
// considered to have been defined in the scope in which the
// anonymous union is declared.
- Owner->insert(Context, *F);
+ Owner->insert(*F);
S->AddDecl(*F);
IdResolver.AddDecl(*F);
}
@@ -1090,7 +1090,7 @@ Sema::DeclTy *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
// Add the anonymous struct/union object to the current
// context. We'll be referencing this object when we refer to one of
// its members.
- Owner->addDecl(Context, Anon);
+ Owner->addDecl(Anon);
// Inject the members of the anonymous struct/union into the owning
// context and into the identifier resolver chain for name lookup
@@ -3126,7 +3126,7 @@ CreateNewDecl:
} else
PushOnScopeChains(New, S);
} else {
- LexicalContext->addDecl(Context, New);
+ LexicalContext->addDecl(New);
}
return New;
@@ -3296,7 +3296,7 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagD,
if (II) {
PushOnScopeChains(NewFD, S);
} else
- Record->addDecl(Context, NewFD);
+ Record->addDecl(NewFD);
return NewFD;
}
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index dcd378936a1..d7cef91f339 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -797,7 +797,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*isImplicitlyDeclared=*/true);
DefaultCon->setAccess(AS_public);
DefaultCon->setImplicit();
- ClassDecl->addDecl(Context, DefaultCon);
+ ClassDecl->addDecl(DefaultCon);
// Notify the class that we've added a constructor.
ClassDecl->addedConstructor(Context, DefaultCon);
@@ -878,7 +878,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
CopyConstructor->setParams(&FromParam, 1);
ClassDecl->addedConstructor(Context, CopyConstructor);
- ClassDecl->addDecl(Context, CopyConstructor);
+ ClassDecl->addDecl(CopyConstructor);
}
if (!ClassDecl->hasUserDeclaredCopyAssignment()) {
@@ -956,7 +956,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
// Don't call addedAssignmentOperator. There is no way to distinguish an
// implicit from an explicit assignment operator.
- ClassDecl->addDecl(Context, CopyAssignment);
+ ClassDecl->addDecl(CopyAssignment);
}
if (!ClassDecl->hasUserDeclaredDestructor()) {
@@ -975,7 +975,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*isImplicitlyDeclared=*/true);
Destructor->setAccess(AS_public);
Destructor->setImplicit();
- ClassDecl->addDecl(Context, Destructor);
+ ClassDecl->addDecl(Destructor);
}
}
@@ -2123,7 +2123,7 @@ Sema::DeclTy *Sema::ActOnStartLinkageSpecification(Scope *S,
LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext,
LangLoc, Language,
LBraceLoc.isValid());
- CurContext->addDecl(Context, D);
+ CurContext->addDecl(D);
PushDeclContext(S, D);
return D;
}
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index afcf45622b9..f6a245a3172 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -100,7 +100,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
ObjCInterfaceDecls[ClassName] = IDecl;
// FIXME: PushOnScopeChains
- CurContext->addDecl(Context, IDecl);
+ CurContext->addDecl(IDecl);
// Remember that this needs to be removed when the scope is popped.
TUScope->AddDecl(IDecl);
}
@@ -185,7 +185,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
ObjCAliasDecls[AliasName] = AliasDecl;
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, AliasDecl);
+ CurContext->addDecl(AliasDecl);
if (!CheckObjCDeclScope(AliasDecl))
TUScope->AddDecl(AliasDecl);
@@ -219,7 +219,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
PDecl = ObjCProtocolDecl::Create(Context, CurContext,
AtProtoInterfaceLoc,ProtocolName);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
PDecl->setForwardDecl(false);
ObjCProtocols[ProtocolName] = PDecl;
}
@@ -444,7 +444,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
PDecl = ObjCProtocolDecl::Create(Context, CurContext,
IdentList[i].second, Ident);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
}
if (attrList)
ProcessDeclAttributeList(PDecl, attrList);
@@ -454,7 +454,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
ObjCForwardProtocolDecl *PDecl =
ObjCForwardProtocolDecl::Create(Context, CurContext, AtProtocolLoc,
&Protocols[0], Protocols.size());
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
CheckObjCDeclScope(PDecl);
return PDecl;
}
@@ -472,7 +472,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
ObjCCategoryDecl *CDecl =
ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, CategoryName);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, CDecl);
+ CurContext->addDecl(CDecl);
CDecl->setClassInterface(IDecl);
/// Check that class of this category is already completely declared.
@@ -519,7 +519,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryImplementation(
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, CDecl);
+ CurContext->addDecl(CDecl);
/// TODO: Check that CatName, category name, is not used in another
// implementation.
@@ -585,7 +585,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
IDecl->setLocEnd(ClassLoc);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, IDecl);
+ CurContext->addDecl(IDecl);
// Remember that this needs to be removed when the scope is popped.
TUScope->AddDecl(IDecl);
}
@@ -595,7 +595,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
ClassName, IDecl, SDecl);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, IMPDecl);
+ CurContext->addDecl(IMPDecl);
if (CheckObjCDeclScope(IMPDecl))
return IMPDecl;
@@ -938,7 +938,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
ObjCInterfaceDecls[IdentList[i]] = IDecl;
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, IDecl);
+ CurContext->addDecl(IDecl);
// Remember that this needs to be removed when the scope is popped.
TUScope->AddDecl(IDecl);
}
@@ -949,7 +949,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
ObjCClassDecl *CDecl = ObjCClassDecl::Create(Context, CurContext, AtClassLoc,
&Interfaces[0],
Interfaces.size());
- CurContext->addDecl(Context, CDecl);
+ CurContext->addDecl(CDecl);
CheckObjCDeclScope(CDecl);
return CDecl;
}
@@ -1114,7 +1114,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
ObjCPropertyDecl::Optional) ?
ObjCMethodDecl::Optional :
ObjCMethodDecl::Required);
- CD->addDecl(Context, GetterMethod);
+ CD->addDecl(GetterMethod);
} else
// A user declared getter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
@@ -1145,7 +1145,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
VarDecl::None,
0, 0);
SetterMethod->setMethodParams(&Argument, 1);
- CD->addDecl(Context, SetterMethod);
+ CD->addDecl(SetterMethod);
} else
// A user declared setter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
@@ -1210,7 +1210,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl,
<< Method->getDeclName();
Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
} else {
- DC->addDecl(Context, Method);
+ DC->addDecl(Method);
InsMap[Method->getSelector()] = Method;
/// The following allows us to typecheck messages to "id".
AddInstanceMethodToGlobalPool(Method);
@@ -1227,7 +1227,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl,
<< Method->getDeclName();
Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
} else {
- DC->addDecl(Context, Method);
+ DC->addDecl(Method);
ClsMap[Method->getSelector()] = Method;
/// The following allows us to typecheck messages to "Class".
AddFactoryMethodToGlobalPool(Method);
@@ -1567,7 +1567,7 @@ Sema::DeclTy *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
assert(DC && "ClassDecl is not a DeclContext");
ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC, AtLoc,
FD.D.getIdentifier(), T);
- DC->addDecl(Context, PDecl);
+ DC->addDecl(PDecl);
// Regardless of setter/getter attribute, we save the default getter/setter
// selector names in anticipation of declaration of setter/getter methods.
@@ -1707,7 +1707,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
ObjCPropertyImplDecl::Synthesize
: ObjCPropertyImplDecl::Dynamic),
Ivar);
- CurContext->addDecl(Context, PIDecl);
+ CurContext->addDecl(PIDecl);
if (IC) {
if (Synthesize)
if (ObjCPropertyImplDecl *PPIDecl =
@@ -1801,7 +1801,7 @@ void Sema::ActOnDefs(Scope *S, DeclTy *TagD, SourceLocation DeclStart,
if (getLangOptions().CPlusPlus)
PushOnScopeChains(cast<FieldDecl>(FD), S);
else if (RecordDecl *Record = dyn_cast<RecordDecl>((Decl*)TagD))
- Record->addDecl(Context, FD);
+ Record->addDecl(FD);
}
}
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 111dca4ae02..99e00a7a82a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -540,7 +540,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
// FIXME: Also add this declaration to the IdentifierResolver, but
// make sure it is at the end of the chain to coincide with the
// global scope.
- ((DeclContext *)TUScope->getEntity())->addDecl(Context, Alloc);
+ ((DeclContext *)TUScope->getEntity())->addDecl(Alloc);
}
/// ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
OpenPOWER on IntegriCloud