// Create fields
for (unsigned i = 0; i < 2; ++i) {
- SuperStructDecl->addDecl(*Context,
- FieldDecl::Create(*Context, SuperStructDecl,
+ SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl,
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
- /*Mutable=*/false, 0),
- true);
+ /*Mutable=*/false, 0));
}
SuperStructDecl->completeDefinition(*Context);
// Create fields
for (unsigned i = 0; i < 4; ++i) {
- ConstantStringDecl->addDecl(*Context,
- FieldDecl::Create(*Context,
+ ConstantStringDecl->addDecl(FieldDecl::Create(*Context,
ConstantStringDecl,
SourceLocation(), 0,
FieldTypes[i],
/*BitWidth=*/0,
- /*Mutable=*/true, 0),
- true);
+ /*Mutable=*/true, 0));
}
ConstantStringDecl->completeDefinition(*Context);
}
};
- /// addDecl - Add the declaration D to this scope. Note that
- /// declarations are added at the beginning of the declaration
- /// chain, so reverseDeclChain() should be called after all
- /// declarations have been added. If AllowLookup, also adds this
- /// declaration into data structure for name lookup.
- void addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup = true);
+ /// addDecl - Add the declaration D to this scope, and into data structure
+ /// for name lookup.
+ void addDecl(ScopedDecl *D);
void buildLookup(DeclContext *DCtx);
/// that this replacement is semantically correct, e.g., that
/// declarations are only replaced by later declarations of the same
/// entity and not a declaration of some other kind of entity.
- void insert(ASTContext &Context, ScopedDecl *D);
+ void insert(ScopedDecl *D);
static bool classof(const Decl *D) {
switch (D->getKind()) {
RecFields[i]->getIdentifier(),
RecFields[i]->getType(),
RecFields[i]->getBitWidth(), false, 0);
- NewRD->addDecl(*this, Field);
+ NewRD->addDecl(Field);
}
NewRD->completeDefinition(*this);
RD = NewRD;
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false, /*PrevDecl=*/0);
- CFConstantStringTypeDecl->addDecl(*this, Field, true);
+ CFConstantStringTypeDecl->addDecl(Field);
}
CFConstantStringTypeDecl->completeDefinition(*this);
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false, /*PrevDecl=*/0);
- ObjCFastEnumerationStateTypeDecl->addDecl(*this, Field, true);
+ ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
}
}
-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");
} 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
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;
}
// 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) {
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);
// 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
// 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);
}
// 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
} else
PushOnScopeChains(New, S);
} else {
- LexicalContext->addDecl(Context, New);
+ LexicalContext->addDecl(New);
}
return New;
if (II) {
PushOnScopeChains(NewFD, S);
} else
- Record->addDecl(Context, NewFD);
+ Record->addDecl(NewFD);
return NewFD;
}
/*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);
CopyConstructor->setParams(&FromParam, 1);
ClassDecl->addedConstructor(Context, CopyConstructor);
- ClassDecl->addDecl(Context, CopyConstructor);
+ ClassDecl->addDecl(CopyConstructor);
}
if (!ClassDecl->hasUserDeclaredCopyAssignment()) {
// 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()) {
/*isImplicitlyDeclared=*/true);
Destructor->setAccess(AS_public);
Destructor->setImplicit();
- ClassDecl->addDecl(Context, Destructor);
+ ClassDecl->addDecl(Destructor);
}
}
LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext,
LangLoc, Language,
LBraceLoc.isValid());
- CurContext->addDecl(Context, D);
+ CurContext->addDecl(D);
PushDeclContext(S, D);
return D;
}
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);
}
ObjCAliasDecls[AliasName] = AliasDecl;
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, AliasDecl);
+ CurContext->addDecl(AliasDecl);
if (!CheckObjCDeclScope(AliasDecl))
TUScope->AddDecl(AliasDecl);
PDecl = ObjCProtocolDecl::Create(Context, CurContext,
AtProtoInterfaceLoc,ProtocolName);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
PDecl->setForwardDecl(false);
ObjCProtocols[ProtocolName] = PDecl;
}
PDecl = ObjCProtocolDecl::Create(Context, CurContext,
IdentList[i].second, Ident);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
}
if (attrList)
ProcessDeclAttributeList(PDecl, attrList);
ObjCForwardProtocolDecl *PDecl =
ObjCForwardProtocolDecl::Create(Context, CurContext, AtProtocolLoc,
&Protocols[0], Protocols.size());
- CurContext->addDecl(Context, PDecl);
+ CurContext->addDecl(PDecl);
CheckObjCDeclScope(PDecl);
return PDecl;
}
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.
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.
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);
}
ClassName, IDecl, SDecl);
// FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, IMPDecl);
+ CurContext->addDecl(IMPDecl);
if (CheckObjCDeclScope(IMPDecl))
return IMPDecl;
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);
}
ObjCClassDecl *CDecl = ObjCClassDecl::Create(Context, CurContext, AtClassLoc,
&Interfaces[0],
Interfaces.size());
- CurContext->addDecl(Context, CDecl);
+ CurContext->addDecl(CDecl);
CheckObjCDeclScope(CDecl);
return CDecl;
}
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
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
<< 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);
<< 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);
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.
ObjCPropertyImplDecl::Synthesize
: ObjCPropertyImplDecl::Dynamic),
Ivar);
- CurContext->addDecl(Context, PIDecl);
+ CurContext->addDecl(PIDecl);
if (IC) {
if (Synthesize)
if (ObjCPropertyImplDecl *PPIDecl =
if (getLangOptions().CPlusPlus)
PushOnScopeChains(cast<FieldDecl>(FD), S);
else if (RecordDecl *Record = dyn_cast<RecordDecl>((Decl*)TagD))
- Record->addDecl(Context, FD);
+ Record->addDecl(FD);
}
}
// 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: