aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-06-30 02:36:12 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-06-30 02:36:12 +0000
commit17945a0f64fe03ff6ec0c2146005a87636e3ac12 (patch)
tree76e53886f0d07ed0cd801ee8820e3f0abca65991
parent048f30a483ca352ee7f235a5be181b9dcc5f9d9c (diff)
De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74506 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Decl.h20
-rw-r--r--include/clang/AST/DeclBase.h32
-rw-r--r--include/clang/AST/DeclObjC.h131
-rw-r--r--lib/AST/ASTContext.cpp37
-rw-r--r--lib/AST/DeclBase.cpp67
-rw-r--r--lib/AST/DeclCXX.cpp8
-rw-r--r--lib/AST/DeclObjC.cpp103
-rw-r--r--lib/AST/DeclPrinter.cpp5
-rw-r--r--lib/AST/ExprConstant.cpp4
-rw-r--r--lib/Analysis/CFRefCount.cpp13
-rw-r--r--lib/Analysis/CheckObjCDealloc.cpp8
-rw-r--r--lib/Analysis/CheckObjCInstMethSignature.cpp8
-rw-r--r--lib/Analysis/CheckObjCUnusedIVars.cpp8
-rw-r--r--lib/Analysis/RegionStore.cpp6
-rw-r--r--lib/CodeGen/CGCXX.cpp4
-rw-r--r--lib/CodeGen/CGCall.cpp12
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp7
-rw-r--r--lib/CodeGen/CGExprAgg.cpp8
-rw-r--r--lib/CodeGen/CGExprConstant.cpp8
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp23
-rw-r--r--lib/CodeGen/CGObjCMac.cpp61
-rw-r--r--lib/CodeGen/CodeGenModule.cpp15
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp10
-rw-r--r--lib/CodeGen/TargetABIInfo.cpp24
-rw-r--r--lib/Frontend/ASTConsumers.cpp7
-rw-r--r--lib/Frontend/AnalysisConsumer.cpp4
-rw-r--r--lib/Frontend/DeclXML.cpp8
-rw-r--r--lib/Frontend/PCHWriter.cpp9
-rw-r--r--lib/Frontend/ResolveLocation.cpp2
-rw-r--r--lib/Frontend/RewriteBlocks.cpp22
-rw-r--r--lib/Frontend/RewriteObjC.cpp115
-rw-r--r--lib/Sema/SemaDecl.cpp24
-rw-r--r--lib/Sema/SemaDeclAttr.cpp4
-rw-r--r--lib/Sema/SemaDeclCXX.cpp59
-rw-r--r--lib/Sema/SemaDeclObjC.cpp155
-rw-r--r--lib/Sema/SemaExpr.cpp54
-rw-r--r--lib/Sema/SemaExprCXX.cpp6
-rw-r--r--lib/Sema/SemaExprObjC.cpp34
-rw-r--r--lib/Sema/SemaInherit.cpp4
-rw-r--r--lib/Sema/SemaInit.cpp29
-rw-r--r--lib/Sema/SemaLookup.cpp12
-rw-r--r--lib/Sema/SemaOverload.cpp9
-rw-r--r--lib/Sema/SemaTemplate.cpp6
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp8
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp31
-rw-r--r--lib/Sema/SemaTemplateInstantiateExpr.cpp3
46 files changed, 562 insertions, 665 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index ab92d52bb1..69a52869d8 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -1262,12 +1262,12 @@ public:
// enumeration.
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
- enumerator_iterator enumerator_begin(ASTContext &Context) const {
- return enumerator_iterator(this->decls_begin(Context));
+ enumerator_iterator enumerator_begin() const {
+ return enumerator_iterator(this->decls_begin());
}
- enumerator_iterator enumerator_end(ASTContext &Context) const {
- return enumerator_iterator(this->decls_end(Context));
+ enumerator_iterator enumerator_end() const {
+ return enumerator_iterator(this->decls_end());
}
/// getIntegerType - Return the integer type this enum decl corresponds to.
@@ -1370,17 +1370,17 @@ public:
// data members, functions, constructors, destructors, etc.
typedef specific_decl_iterator<FieldDecl> field_iterator;
- field_iterator field_begin(ASTContext &Context) const {
- return field_iterator(decls_begin(Context));
+ field_iterator field_begin() const {
+ return field_iterator(decls_begin());
}
- field_iterator field_end(ASTContext &Context) const {
- return field_iterator(decls_end(Context));
+ field_iterator field_end() const {
+ return field_iterator(decls_end());
}
// field_empty - Whether there are any fields (non-static data
// members) in this record.
- bool field_empty(ASTContext &Context) const {
- return field_begin(Context) == field_end(Context);
+ bool field_empty() const {
+ return field_begin() == field_end();
}
/// completeDefinition - Notes that the definition of this type is
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 80322ff584..0bce2f84c7 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -601,9 +601,9 @@ public:
/// decls_begin/decls_end - Iterate over the declarations stored in
/// this context.
- decl_iterator decls_begin(ASTContext &Context) const;
- decl_iterator decls_end(ASTContext &Context) const;
- bool decls_empty(ASTContext &Context) const;
+ decl_iterator decls_begin() const;
+ decl_iterator decls_end() const;
+ bool decls_empty() const;
/// specific_decl_iterator - Iterates over a subrange of
/// declarations stored in a DeclContext, providing only those that
@@ -759,7 +759,7 @@ public:
///
/// If D is also a NamedDecl, it will be made visible within its
/// semantic context via makeDeclVisibleInContext.
- void addDecl(ASTContext &Context, Decl *D);
+ void addDecl(Decl *D);
/// lookup_iterator - An iterator that provides access to the results
/// of looking up a name within this context.
@@ -778,8 +778,8 @@ public:
/// the declarations with this name, with object, function, member,
/// and enumerator names preceding any tag name. Note that this
/// routine will not look into parent contexts.
- lookup_result lookup(ASTContext &Context, DeclarationName Name);
- lookup_const_result lookup(ASTContext &Context, DeclarationName Name) const;
+ lookup_result lookup(DeclarationName Name);
+ lookup_const_result lookup(DeclarationName Name) const;
/// @brief Makes a declaration visible within this context.
///
@@ -795,7 +795,7 @@ public:
/// visible from this context, as determined by
/// NamedDecl::declarationReplaces, the previous declaration will be
/// replaced with D.
- void makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D);
+ void makeDeclVisibleInContext(NamedDecl *D);
/// udir_iterator - Iterates through the using-directives stored
/// within this context.
@@ -803,14 +803,14 @@ public:
typedef std::pair<udir_iterator, udir_iterator> udir_iterator_range;
- udir_iterator_range getUsingDirectives(ASTContext &Context) const;
+ udir_iterator_range getUsingDirectives() const;
- udir_iterator using_directives_begin(ASTContext &Context) const {
- return getUsingDirectives(Context).first;
+ udir_iterator using_directives_begin() const {
+ return getUsingDirectives().first;
}
- udir_iterator using_directives_end(ASTContext &Context) const {
- return getUsingDirectives(Context).second;
+ udir_iterator using_directives_end() const {
+ return getUsingDirectives().second;
}
// Low-level accessors
@@ -845,11 +845,11 @@ public:
#include "clang/AST/DeclNodes.def"
private:
- void LoadLexicalDeclsFromExternalStorage(ASTContext &Context) const;
- void LoadVisibleDeclsFromExternalStorage(ASTContext &Context) const;
+ void LoadLexicalDeclsFromExternalStorage() const;
+ void LoadVisibleDeclsFromExternalStorage() const;
- void buildLookup(ASTContext &Context, DeclContext *DCtx);
- void makeDeclVisibleInContextImpl(ASTContext &Context, NamedDecl *D);
+ void buildLookup(DeclContext *DCtx);
+ void makeDeclVisibleInContextImpl(NamedDecl *D);
};
inline bool Decl::isTemplateParameter() const {
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 8586c41891..2fcdaa3e29 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -291,55 +291,52 @@ public:
// Iterator access to properties.
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
- prop_iterator prop_begin(ASTContext &Context) const {
- return prop_iterator(decls_begin(Context));
+ prop_iterator prop_begin() const {
+ return prop_iterator(decls_begin());
}
- prop_iterator prop_end(ASTContext &Context) const {
- return prop_iterator(decls_end(Context));
+ prop_iterator prop_end() const {
+ return prop_iterator(decls_end());
}
// Iterator access to instance/class methods.
typedef specific_decl_iterator<ObjCMethodDecl> method_iterator;
- method_iterator meth_begin(ASTContext &Context) const {
- return method_iterator(decls_begin(Context));
+ method_iterator meth_begin() const {
+ return method_iterator(decls_begin());
}
- method_iterator meth_end(ASTContext &Context) const {
- return method_iterator(decls_end(Context));
+ method_iterator meth_end() const {
+ return method_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isInstanceMethod>
instmeth_iterator;
- instmeth_iterator instmeth_begin(ASTContext &Context) const {
- return instmeth_iterator(decls_begin(Context));
+ instmeth_iterator instmeth_begin() const {
+ return instmeth_iterator(decls_begin());
}
- instmeth_iterator instmeth_end(ASTContext &Context) const {
- return instmeth_iterator(decls_end(Context));
+ instmeth_iterator instmeth_end() const {
+ return instmeth_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isClassMethod>
classmeth_iterator;
- classmeth_iterator classmeth_begin(ASTContext &Context) const {
- return classmeth_iterator(decls_begin(Context));
+ classmeth_iterator classmeth_begin() const {
+ return classmeth_iterator(decls_begin());
}
- classmeth_iterator classmeth_end(ASTContext &Context) const {
- return classmeth_iterator(decls_end(Context));
+ classmeth_iterator classmeth_end() const {
+ return classmeth_iterator(decls_end());
}
// Get the local instance/class method declared in this interface.
- ObjCMethodDecl *getInstanceMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getClassMethod(ASTContext &Context, Selector Sel) const;
- ObjCIvarDecl *getIvarDecl(ASTContext &Context, IdentifierInfo *Id) const;
+ ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
+ ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCIvarDecl *getIvarDecl(IdentifierInfo *Id) const;
- ObjCMethodDecl *
- getMethod(ASTContext &Context, Selector Sel, bool isInstance) const {
- return isInstance ? getInstanceMethod(Context, Sel)
- : getClassMethod(Context, Sel);
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel) : getClassMethod(Sel);
}
- ObjCPropertyDecl *FindPropertyDeclaration(ASTContext &Context,
- IdentifierInfo *PropertyId) const;
+ ObjCPropertyDecl *FindPropertyDeclaration(IdentifierInfo *PropertyId) const;
// Marks the end of the container.
SourceLocation getAtEndLoc() const { return AtEndLoc; }
@@ -474,19 +471,17 @@ public:
return false;
}
- ObjCIvarDecl *lookupInstanceVariable(ASTContext &Context,
- IdentifierInfo *IVarName,
+ ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
ObjCInterfaceDecl *&ClassDeclared);
- ObjCIvarDecl *lookupInstanceVariable(ASTContext &Context,
- IdentifierInfo *IVarName) {
+ ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {
ObjCInterfaceDecl *ClassDeclared;
- return lookupInstanceVariable(Context, IVarName, ClassDeclared);
+ return lookupInstanceVariable(IVarName, ClassDeclared);
}
// Lookup a method. First, we search locally. If a method isn't
// found, we search referenced protocols and class categories.
- ObjCMethodDecl *lookupInstanceMethod(ASTContext &Context, Selector Sel);
- ObjCMethodDecl *lookupClassMethod(ASTContext &Context, Selector Sel);
+ ObjCMethodDecl *lookupInstanceMethod(Selector Sel);
+ ObjCMethodDecl *lookupClassMethod(Selector Sel);
ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
// Location information, modeled after the Stmt API.
@@ -648,8 +643,8 @@ public:
// Lookup a method. First, we search locally. If a method isn't
// found, we search referenced protocols and class categories.
- ObjCMethodDecl *lookupInstanceMethod(ASTContext &Context, Selector Sel);
- ObjCMethodDecl *lookupClassMethod(ASTContext &Context, Selector Sel);
+ ObjCMethodDecl *lookupInstanceMethod(Selector Sel);
+ ObjCMethodDecl *lookupClassMethod(Selector Sel);
bool isForwardDecl() const { return isForwardProtoDecl; }
void setForwardDecl(bool val) { isForwardProtoDecl = val; }
@@ -831,61 +826,57 @@ public:
ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
void setClassInterface(ObjCInterfaceDecl *IFace) { ClassInterface = IFace; }
- void addInstanceMethod(ASTContext &Context, ObjCMethodDecl *method) {
+ void addInstanceMethod(ObjCMethodDecl *method) {
// FIXME: Context should be set correctly before we get here.
method->setLexicalDeclContext(this);
- addDecl(Context, method);
+ addDecl(method);
}
- void addClassMethod(ASTContext &Context, ObjCMethodDecl *method) {
+ void addClassMethod(ObjCMethodDecl *method) {
// FIXME: Context should be set correctly before we get here.
method->setLexicalDeclContext(this);
- addDecl(Context, method);
+ addDecl(method);
}
// Get the local instance/class method declared in this interface.
- ObjCMethodDecl *getInstanceMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getClassMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getMethod(ASTContext &Context, Selector Sel,
- bool isInstance) const {
- return isInstance ? getInstanceMethod(Context, Sel)
- : getClassMethod(Context, Sel);
+ ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
+ ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel)
+ : getClassMethod(Sel);
}
- void addPropertyImplementation(ASTContext &Context,
- ObjCPropertyImplDecl *property);
+ void addPropertyImplementation(ObjCPropertyImplDecl *property);
- ObjCPropertyImplDecl *FindPropertyImplDecl(ASTContext &Context,
- IdentifierInfo *propertyId) const;
- ObjCPropertyImplDecl *FindPropertyImplIvarDecl(ASTContext &Context,
- IdentifierInfo *ivarId) const;
+ ObjCPropertyImplDecl *FindPropertyImplDecl(IdentifierInfo *propertyId) const;
+ ObjCPropertyImplDecl *FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const;
// Iterator access to properties.
typedef specific_decl_iterator<ObjCPropertyImplDecl> propimpl_iterator;
- propimpl_iterator propimpl_begin(ASTContext &Context) const {
- return propimpl_iterator(decls_begin(Context));
+ propimpl_iterator propimpl_begin() const {
+ return propimpl_iterator(decls_begin());
}
- propimpl_iterator propimpl_end(ASTContext &Context) const {
- return propimpl_iterator(decls_end(Context));
+ propimpl_iterator propimpl_end() const {
+ return propimpl_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isInstanceMethod>
instmeth_iterator;
- instmeth_iterator instmeth_begin(ASTContext &Context) const {
- return instmeth_iterator(decls_begin(Context));
+ instmeth_iterator instmeth_begin() const {
+ return instmeth_iterator(decls_begin());
}
- instmeth_iterator instmeth_end(ASTContext &Context) const {
- return instmeth_iterator(decls_end(Context));
+ instmeth_iterator instmeth_end() const {
+ return instmeth_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isClassMethod>
classmeth_iterator;
- classmeth_iterator classmeth_begin(ASTContext &Context) const {
- return classmeth_iterator(decls_begin(Context));
+ classmeth_iterator classmeth_begin() const {
+ return classmeth_iterator(decls_begin());
}
- classmeth_iterator classmeth_end(ASTContext &Context) const {
- return classmeth_iterator(decls_end(Context));
+ classmeth_iterator classmeth_end() const {
+ return classmeth_iterator(decls_end());
}
// Location information, modeled after the Stmt API.
@@ -1002,17 +993,17 @@ public:
void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
- ivar_iterator ivar_begin(ASTContext &Context) const {
- return ivar_iterator(decls_begin(Context));
+ ivar_iterator ivar_begin() const {
+ return ivar_iterator(decls_begin());
}
- ivar_iterator ivar_end(ASTContext &Context) const {
- return ivar_iterator(decls_end(Context));
+ ivar_iterator ivar_end() const {
+ return ivar_iterator(decls_end());
}
- unsigned ivar_size(ASTContext &Context) const {
- return std::distance(ivar_begin(Context), ivar_end(Context));
+ unsigned ivar_size() const {
+ return std::distance(ivar_begin(), ivar_end());
}
- bool ivar_empty(ASTContext &Context) const {
- return ivar_begin(Context) == ivar_end(Context);
+ bool ivar_empty() const {
+ return ivar_begin() == ivar_end();
}
static bool classof(const Decl *D) {
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 4f78ad9800..7f945db1d3 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -630,8 +630,8 @@ void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI,
void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD,
llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
- for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(*this),
- E = PD->prop_end(*this); I != E; ++I)
+ for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(),
+ E = PD->prop_end(); I != E; ++I)
if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
Ivars.push_back(Ivar);
@@ -646,8 +646,8 @@ void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD,
///
void ASTContext::CollectSynthesizedIvars(const ObjCInterfaceDecl *OI,
llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
- for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*this),
- E = OI->prop_end(*this); I != E; ++I) {
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
+ E = OI->prop_end(); I != E; ++I) {
if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
Ivars.push_back(Ivar);
}
@@ -662,8 +662,8 @@ void ASTContext::CollectSynthesizedIvars(const ObjCInterfaceDecl *OI,
unsigned ASTContext::CountProtocolSynthesizedIvars(const ObjCProtocolDecl *PD) {
unsigned count = 0;
- for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(*this),
- E = PD->prop_end(*this); I != E; ++I)
+ for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(),
+ E = PD->prop_end(); I != E; ++I)
if ((*I)->getPropertyIvarDecl())
++count;
@@ -677,8 +677,8 @@ unsigned ASTContext::CountProtocolSynthesizedIvars(const ObjCProtocolDecl *PD) {
unsigned ASTContext::CountSynthesizedIvars(const ObjCInterfaceDecl *OI)
{
unsigned count = 0;
- for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*this),
- E = OI->prop_end(*this); I != E; ++I) {
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
+ E = OI->prop_end(); I != E; ++I) {
if ((*I)->getPropertyIvarDecl())
++count;
}
@@ -785,8 +785,7 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) {
Entry = NewEntry;
// FIXME: Avoid linear walk through the fields, if possible.
- NewEntry->InitializeLayout(std::distance(D->field_begin(*this),
- D->field_end(*this)));
+ NewEntry->InitializeLayout(std::distance(D->field_begin(), D->field_end()));
bool IsUnion = D->isUnion();
unsigned StructPacking = 0;
@@ -800,8 +799,8 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) {
// Layout each field, for now, just sequentially, respecting alignment. In
// the future, this will need to be tweakable by targets.
unsigned FieldIdx = 0;
- for (RecordDecl::field_iterator Field = D->field_begin(*this),
- FieldEnd = D->field_end(*this);
+ for (RecordDecl::field_iterator Field = D->field_begin(),
+ FieldEnd = D->field_end();
Field != FieldEnd; (void)++Field, ++FieldIdx)
NewEntry->LayoutField(*Field, FieldIdx, IsUnion, StructPacking, *this);
@@ -2141,7 +2140,7 @@ QualType ASTContext::getCFConstantStringType() {
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false);
- CFConstantStringTypeDecl->addDecl(*this, Field);
+ CFConstantStringTypeDecl->addDecl(Field);
}
CFConstantStringTypeDecl->completeDefinition(*this);
@@ -2177,7 +2176,7 @@ QualType ASTContext::getObjCFastEnumerationStateType()
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
/*Mutable=*/false);
- ObjCFastEnumerationStateTypeDecl->addDecl(*this, Field);
+ ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
@@ -2304,7 +2303,7 @@ void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
if (const ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(Container)) {
for (ObjCCategoryImplDecl::propimpl_iterator
- i = CID->propimpl_begin(*this), e = CID->propimpl_end(*this);
+ i = CID->propimpl_begin(), e = CID->propimpl_end();
i != e; ++i) {
ObjCPropertyImplDecl *PID = *i;
if (PID->getPropertyDecl() == PD) {
@@ -2318,7 +2317,7 @@ void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
} else {
const ObjCImplementationDecl *OID=cast<ObjCImplementationDecl>(Container);
for (ObjCCategoryImplDecl::propimpl_iterator
- i = OID->propimpl_begin(*this), e = OID->propimpl_end(*this);
+ i = OID->propimpl_begin(), e = OID->propimpl_end();
i != e; ++i) {
ObjCPropertyImplDecl *PID = *i;
if (PID->getPropertyDecl() == PD) {
@@ -2609,8 +2608,8 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
}
if (ExpandStructures) {
S += '=';
- for (RecordDecl::field_iterator Field = RDecl->field_begin(*this),
- FieldEnd = RDecl->field_end(*this);
+ for (RecordDecl::field_iterator Field = RDecl->field_begin(),
+ FieldEnd = RDecl->field_end();
Field != FieldEnd; ++Field) {
if (FD) {
S += '"';
@@ -3576,7 +3575,7 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
case 'P': {
IdentifierInfo *II = &Context.Idents.get("FILE");
DeclContext::lookup_result Lookup
- = Context.getTranslationUnitDecl()->lookup(Context, II);
+ = Context.getTranslationUnitDecl()->lookup(II);
if (Lookup.first != Lookup.second && isa<TypeDecl>(*Lookup.first)) {
Type = Context.getTypeDeclType(cast<TypeDecl>(*Lookup.first));
break;
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index a4609d45ad..96ba19b9a6 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -409,7 +409,7 @@ DeclContext::~DeclContext() {
}
void DeclContext::DestroyDecls(ASTContext &C) {
- for (decl_iterator D = decls_begin(C); D != decls_end(C); )
+ for (decl_iterator D = decls_begin(); D != decls_end(); )
(*D++)->Destroy(C);
}
@@ -500,8 +500,8 @@ DeclContext *DeclContext::getNextContext() {
/// \brief Load the declarations within this lexical storage from an
/// external source.
void
-DeclContext::LoadLexicalDeclsFromExternalStorage(ASTContext &Context) const {
- ExternalASTSource *Source = Context.getExternalSource();
+DeclContext::LoadLexicalDeclsFromExternalStorage() const {
+ ExternalASTSource *Source = getParentASTContext().getExternalSource();
assert(hasExternalLexicalStorage() && Source && "No external storage?");
llvm::SmallVector<uint32_t, 64> Decls;
@@ -538,9 +538,9 @@ DeclContext::LoadLexicalDeclsFromExternalStorage(ASTContext &Context) const {
}
void
-DeclContext::LoadVisibleDeclsFromExternalStorage(ASTContext &Context) const {
+DeclContext::LoadVisibleDeclsFromExternalStorage() const {
DeclContext *This = const_cast<DeclContext *>(this);
- ExternalASTSource *Source = Context.getExternalSource();
+ ExternalASTSource *Source = getParentASTContext().getExternalSource();
assert(hasExternalVisibleStorage() && Source && "No external storage?");
llvm::SmallVector<VisibleDeclaration, 64> Decls;
@@ -560,30 +560,30 @@ DeclContext::LoadVisibleDeclsFromExternalStorage(ASTContext &Context) const {
}
}
-DeclContext::decl_iterator DeclContext::decls_begin(ASTContext &Context) const {
+DeclContext::decl_iterator DeclContext::decls_begin() const {
if (hasExternalLexicalStorage())
- LoadLexicalDeclsFromExternalStorage(Context);
+ LoadLexicalDeclsFromExternalStorage();
// FIXME: Check whether we need to load some declarations from
// external storage.
return decl_iterator(FirstDecl);
}
-DeclContext::decl_iterator DeclContext::decls_end(ASTContext &Context) const {
+DeclContext::decl_iterator DeclContext::decls_end() const {
if (hasExternalLexicalStorage())
- LoadLexicalDeclsFromExternalStorage(Context);
+ LoadLexicalDeclsFromExternalStorage();
return decl_iterator();
}
-bool DeclContext::decls_empty(ASTContext &Context) const {
+bool DeclContext::decls_empty() const {
if (hasExternalLexicalStorage())
- LoadLexicalDeclsFromExternalStorage(Context);
+ LoadLexicalDeclsFromExternalStorage();
return !FirstDecl;
}
-void DeclContext::addDecl(ASTContext &Context, Decl *D) {
+void DeclContext::addDecl(Decl *D) {
assert(D->getLexicalDeclContext() == this &&
"Decl inserted into wrong lexical context");
assert(!D->getNextDeclInContext() && D != LastDecl &&
@@ -597,44 +597,44 @@ void DeclContext::addDecl(ASTContext &Context, Decl *D) {
}
if (NamedDecl *ND = dyn_cast<NamedDecl>(D))
- ND->getDeclContext()->makeDeclVisibleInContext(Context, ND);
+ ND->getDeclContext()->makeDeclVisibleInContext(ND);
}
/// buildLookup - Build the lookup data structure with all of the
/// declarations in DCtx (and any other contexts linked to it or
/// transparent contexts nested within it).
-void DeclContext::buildLookup(ASTContext &Context, DeclContext *DCtx) {
+void DeclContext::buildLookup(DeclContext *DCtx) {
for (; DCtx; DCtx = DCtx->getNextContext()) {
- for (decl_iterator D = DCtx->decls_begin(Context),
- DEnd = DCtx->decls_end(Context);
+ for (decl_iterator D = DCtx->decls_begin(),
+ DEnd = DCtx->decls_end();
D != DEnd; ++D) {
// Insert this declaration into the lookup structure
if (NamedDecl *ND = dyn_cast<NamedDecl>(*D))
- makeDeclVisibleInContextImpl(Context, ND);
+ makeDeclVisibleInContextImpl(ND);
// If this declaration is itself a transparent declaration context,