From: Argyrios Kyrtzidis Date: Tue, 30 Jun 2009 02:36:12 +0000 (+0000) Subject: De-ASTContext-ify DeclContext. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17945a0f64fe03ff6ec0c2146005a87636e3ac12;p=clang 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 --- 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 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 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_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 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 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 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 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 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 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 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 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 &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 &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(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(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(*Lookup.first)) { Type = Context.getTypeDeclType(cast(*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 Decls; @@ -538,9 +538,9 @@ DeclContext::LoadLexicalDeclsFromExternalStorage(ASTContext &Context) const { } void -DeclContext::LoadVisibleDeclsFromExternalStorage(ASTContext &Context) const { +DeclContext::LoadVisibleDeclsFromExternalStorage() const { DeclContext *This = const_cast(this); - ExternalASTSource *Source = Context.getExternalSource(); + ExternalASTSource *Source = getParentASTContext().getExternalSource(); assert(hasExternalVisibleStorage() && Source && "No external storage?"); llvm::SmallVector 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(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(*D)) - makeDeclVisibleInContextImpl(Context, ND); + makeDeclVisibleInContextImpl(ND); // If this declaration is itself a transparent declaration context, // add its members (recursively). if (DeclContext *InnerCtx = dyn_cast(*D)) if (InnerCtx->isTransparentContext()) - buildLookup(Context, InnerCtx->getPrimaryContext()); + buildLookup(InnerCtx->getPrimaryContext()); } } } DeclContext::lookup_result -DeclContext::lookup(ASTContext &Context, DeclarationName Name) { +DeclContext::lookup(DeclarationName Name) { DeclContext *PrimaryContext = getPrimaryContext(); if (PrimaryContext != this) - return PrimaryContext->lookup(Context, Name); + return PrimaryContext->lookup(Name); if (hasExternalVisibleStorage()) - LoadVisibleDeclsFromExternalStorage(Context); + LoadVisibleDeclsFromExternalStorage(); /// If there is no lookup data structure, build one now by walking /// all of the linked DeclContexts (in declaration order!) and /// inserting their values. if (!LookupPtr) { - buildLookup(Context, this); + buildLookup(this); if (!LookupPtr) return lookup_result(0, 0); @@ -644,12 +644,12 @@ DeclContext::lookup(ASTContext &Context, DeclarationName Name) { StoredDeclsMap::iterator Pos = Map->find(Name); if (Pos == Map->end()) return lookup_result(0, 0); - return Pos->second.getLookupResult(Context); + return Pos->second.getLookupResult(getParentASTContext()); } DeclContext::lookup_const_result -DeclContext::lookup(ASTContext &Context, DeclarationName Name) const { - return const_cast(this)->lookup(Context, Name); +DeclContext::lookup(DeclarationName Name) const { + return const_cast(this)->lookup(Name); } DeclContext *DeclContext::getLookupContext() { @@ -668,7 +668,7 @@ DeclContext *DeclContext::getEnclosingNamespaceContext() { return Ctx->getPrimaryContext(); } -void DeclContext::makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D) { +void DeclContext::makeDeclVisibleInContext(NamedDecl *D) { // FIXME: This feels like a hack. Should DeclarationName support // template-ids, or is there a better way to keep specializations // from being visible? @@ -677,7 +677,7 @@ void DeclContext::makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D) { DeclContext *PrimaryContext = getPrimaryContext(); if (PrimaryContext != this) { - PrimaryContext->makeDeclVisibleInContext(Context, D); + PrimaryContext->makeDeclVisibleInContext(D); return; } @@ -685,16 +685,15 @@ void DeclContext::makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D) { // into it. Otherwise, be lazy and don't build that structure until // someone asks for it. if (LookupPtr) - makeDeclVisibleInContextImpl(Context, D); + makeDeclVisibleInContextImpl(D); // If we are a transparent context, insert into our parent context, // too. This operation is recursive. if (isTransparentContext()) - getParent()->makeDeclVisibleInContext(Context, D); + getParent()->makeDeclVisibleInContext(D); } -void DeclContext::makeDeclVisibleInContextImpl(ASTContext &Context, - NamedDecl *D) { +void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D) { // Skip unnamed declarations. if (!D->getDeclName()) return; @@ -719,7 +718,7 @@ void DeclContext::makeDeclVisibleInContextImpl(ASTContext &Context, // If it is possible that this is a redeclaration, check to see if there is // already a decl for which declarationReplaces returns true. If there is // one, just replace it and return. - if (DeclNameEntries.HandleRedeclaration(Context, D)) + if (DeclNameEntries.HandleRedeclaration(getParentASTContext(), D)) return; // Put this declaration into the appropriate slot. @@ -729,8 +728,8 @@ void DeclContext::makeDeclVisibleInContextImpl(ASTContext &Context, /// Returns iterator range [First, Last) of UsingDirectiveDecls stored within /// this context. DeclContext::udir_iterator_range -DeclContext::getUsingDirectives(ASTContext &Context) const { - lookup_const_result Result = lookup(Context, UsingDirectiveDecl::getName()); +DeclContext::getUsingDirectives() const { + lookup_const_result Result = lookup(UsingDirectiveDecl::getName()); return udir_iterator_range(reinterpret_cast(Result.first), reinterpret_cast(Result.second)); } diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 8b596e1e7c..1b4dcd86c9 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -78,7 +78,7 @@ CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context, Context.getCanonicalType(ClassType)); unsigned FoundTQs; DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = this->lookup(Context, ConstructorName); + for (llvm::tie(Con, ConEnd) = this->lookup(ConstructorName); Con != ConEnd; ++Con) { if (cast(*Con)->isCopyConstructor(Context, FoundTQs)) { @@ -97,7 +97,7 @@ bool CXXRecordDecl::hasConstCopyAssignment(ASTContext &Context) const { DeclarationName OpName =Context.DeclarationNames.getCXXOperatorName(OO_Equal); DeclContext::lookup_const_iterator Op, OpEnd; - for (llvm::tie(Op, OpEnd) = this->lookup(Context, OpName); + for (llvm::tie(Op, OpEnd) = this->lookup(OpName); Op != OpEnd; ++Op) { // C++ [class.copy]p9: // A user-declared copy assignment operator is a non-static non-template @@ -201,7 +201,7 @@ CXXRecordDecl::getDefaultConstructor(ASTContext &Context) { Context.getCanonicalType(ClassType.getUnqualifiedType())); DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = lookup(Context, ConstructorName); + for (llvm::tie(Con, ConEnd) = lookup(ConstructorName); Con != ConEnd; ++Con) { CXXConstructorDecl *Constructor = cast(*Con); if (Constructor->isDefaultConstructor()) @@ -218,7 +218,7 @@ CXXRecordDecl::getDestructor(ASTContext &Context) { = Context.DeclarationNames.getCXXDestructorName(ClassType); DeclContext::lookup_iterator I, E; - llvm::tie(I, E) = lookup(Context, Name); + llvm::tie(I, E) = lookup(Name); assert(I != E && "Did not find a destructor!"); const CXXDestructorDecl *Dtor = cast(*I); diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 60a96d0471..54f13e14ba 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -45,10 +45,9 @@ void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) { /// getIvarDecl - This method looks up an ivar in this ContextDecl. /// ObjCIvarDecl * -ObjCContainerDecl::getIvarDecl(ASTContext &Context, IdentifierInfo *Id) const { +ObjCContainerDecl::getIvarDecl(IdentifierInfo *Id) const { lookup_const_iterator Ivar, IvarEnd; - for (llvm::tie(Ivar, IvarEnd) = lookup(Context, Id); - Ivar != IvarEnd; ++Ivar) { + for (llvm::tie(Ivar, IvarEnd) = lookup(Id); Ivar != IvarEnd; ++Ivar) { if (ObjCIvarDecl *ivar = dyn_cast(*Ivar)) return ivar; } @@ -57,7 +56,7 @@ ObjCContainerDecl::getIvarDecl(ASTContext &Context, IdentifierInfo *Id) const { // Get the local instance method declared in this interface. ObjCMethodDecl * -ObjCContainerDecl::getInstanceMethod(ASTContext &Context, Selector Sel) const { +ObjCContainerDecl::getInstanceMethod(Selector Sel) const { // Since instance & class methods can have the same name, the loop below // ensures we get the correct method. // @@ -67,8 +66,7 @@ ObjCContainerDecl::getInstanceMethod(ASTContext &Context, Selector Sel) const { // @end // lookup_const_iterator Meth, MethEnd; - for (llvm::tie(Meth, MethEnd) = lookup(Context, Sel); - Meth != MethEnd; ++Meth) { + for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) { ObjCMethodDecl *MD = dyn_cast(*Meth); if (MD && MD->isInstanceMethod()) return MD; @@ -78,7 +76,7 @@ ObjCContainerDecl::getInstanceMethod(ASTContext &Context, Selector Sel) const { // Get the local class method declared in this interface. ObjCMethodDecl * -ObjCContainerDecl::getClassMethod(ASTContext &Context, Selector Sel) const { +ObjCContainerDecl::getClassMethod(Selector Sel) const { // Since instance & class methods can have the same name, the loop below // ensures we get the correct method. // @@ -88,8 +86,7 @@ ObjCContainerDecl::getClassMethod(ASTContext &Context, Selector Sel) const { // @end // lookup_const_iterator Meth, MethEnd; - for (llvm::tie(Meth, MethEnd) = lookup(Context, Sel); - Meth != MethEnd; ++Meth) { + for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) { ObjCMethodDecl *MD = dyn_cast(*Meth); if (MD && MD->isClassMethod()) return MD; @@ -102,10 +99,8 @@ ObjCContainerDecl::getClassMethod(ASTContext &Context, Selector Sel) const { /// FIXME: Convert to DeclContext lookup... /// ObjCPropertyDecl * -ObjCContainerDecl::FindPropertyDeclaration(ASTContext &Context, - IdentifierInfo *PropertyId) const { - for (prop_iterator I = prop_begin(Context), E = prop_end(Context); - I != E; ++I) +ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { + for (prop_iterator I = prop_begin(), E = prop_end(); I != E; ++I) if ((*I)->getIdentifier() == PropertyId) return *I; @@ -113,8 +108,7 @@ ObjCContainerDecl::FindPropertyDeclaration(ASTContext &Context, if (PID) { for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(), E = PID->protocol_end(); I != E; ++I) - if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(Context, - PropertyId)) + if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId)) return P; } @@ -122,37 +116,33 @@ ObjCContainerDecl::FindPropertyDeclaration(ASTContext &Context, // Look through categories. for (ObjCCategoryDecl *Category = OID->getCategoryList(); Category; Category = Category->getNextClassCategory()) { - if (ObjCPropertyDecl *P = Category->FindPropertyDeclaration(Context, - PropertyId)) + if (ObjCPropertyDecl *P = Category->FindPropertyDeclaration(PropertyId)) return P; } // Look through protocols. for (ObjCInterfaceDecl::protocol_iterator I = OID->protocol_begin(), E = OID->protocol_end(); I != E; ++I) { - if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(Context, - PropertyId)) + if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId)) return P; } if (OID->getSuperClass()) - return OID->getSuperClass()->FindPropertyDeclaration(Context, - PropertyId); + return OID->getSuperClass()->FindPropertyDeclaration(PropertyId); } else if (const ObjCCategoryDecl *OCD = dyn_cast(this)) { // Look through protocols. for (ObjCInterfaceDecl::protocol_iterator I = OCD->protocol_begin(), E = OCD->protocol_end(); I != E; ++I) { - if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(Context, - PropertyId)) + if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId)) return P; } } return 0; } -ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable( - ASTContext &Context, IdentifierInfo *ID, ObjCInterfaceDecl *&clsDeclared) { +ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, + ObjCInterfaceDecl *&clsDeclared) { ObjCInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { - if (ObjCIvarDecl *I = ClassDecl->getIvarDecl(Context, ID)) { + if (ObjCIvarDecl *I = ClassDecl->getIvarDecl(ID)) { clsDeclared = ClassDecl; return I; } @@ -177,13 +167,12 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass( /// lookupInstanceMethod - This method returns an instance method by looking in /// the class, its categories, and its super classes (using a linear search). -ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(ASTContext &Context, - Selector Sel) { +ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(Selector Sel) { ObjCInterfaceDecl* ClassDecl = this; ObjCMethodDecl *MethodDecl = 0; while (ClassDecl != NULL) { - if ((MethodDecl = ClassDecl->getInstanceMethod(Context, Sel))) + if ((MethodDecl = ClassDecl->getInstanceMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. @@ -191,13 +180,13 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(ASTContext &Context, ClassDecl->getReferencedProtocols(); for (ObjCList::iterator I = Protocols.begin(), E = Protocols.end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupInstanceMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupInstanceMethod(Sel))) return MethodDecl; // Didn't find one yet - now look through categories. ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); while (CatDecl) { - if ((MethodDecl = CatDecl->getInstanceMethod(Context, Sel))) + if ((MethodDecl = CatDecl->getInstanceMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. @@ -205,7 +194,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(ASTContext &Context, CatDecl->getReferencedProtocols(); for (ObjCList::iterator I = Protocols.begin(), E = Protocols.end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupInstanceMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupInstanceMethod(Sel))) return MethodDecl; CatDecl = CatDecl->getNextClassCategory(); } @@ -216,25 +205,24 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(ASTContext &Context, // lookupClassMethod - This method returns a class method by looking in the // class, its categories, and its super classes (using a linear search). -ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(ASTContext &Context, - Selector Sel) { +ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(Selector Sel) { ObjCInterfaceDecl* ClassDecl = this; ObjCMethodDecl *MethodDecl = 0; while (ClassDecl != NULL) { - if ((MethodDecl = ClassDecl->getClassMethod(Context, Sel))) + if ((MethodDecl = ClassDecl->getClassMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. for (ObjCInterfaceDecl::protocol_iterator I = ClassDecl->protocol_begin(), E = ClassDecl->protocol_end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupClassMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupClassMethod(Sel))) return MethodDecl; // Didn't find one yet - now look through categories. ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); while (CatDecl) { - if ((MethodDecl = CatDecl->getClassMethod(Context, Sel))) + if ((MethodDecl = CatDecl->getClassMethod(Sel))) return MethodDecl; // Didn't find one yet - look through protocols. @@ -242,7 +230,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(ASTContext &Context, CatDecl->getReferencedProtocols(); for (ObjCList::iterator I = Protocols.begin(), E = Protocols.end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupClassMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupClassMethod(Sel))) return MethodDecl; CatDecl = CatDecl->getNextClassCategory(); } @@ -446,30 +434,28 @@ ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) { // lookupInstanceMethod - Lookup a instance method in the protocol and protocols // it inherited. -ObjCMethodDecl *ObjCProtocolDecl::lookupInstanceMethod(ASTContext &Context, - Selector Sel) { +ObjCMethodDecl *ObjCProtocolDecl::lookupInstanceMethod(Selector Sel) { ObjCMethodDecl *MethodDecl = NULL; - if ((MethodDecl = getInstanceMethod(Context, Sel))) + if ((MethodDecl = getInstanceMethod(Sel))) return MethodDecl; for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupInstanceMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupInstanceMethod(Sel))) return MethodDecl; return NULL; } // lookupInstanceMethod - Lookup a class method in the protocol and protocols // it inherited. -ObjCMethodDecl *ObjCProtocolDecl::lookupClassMethod(ASTContext &Context, - Selector Sel) { +ObjCMethodDecl *ObjCProtocolDecl::lookupClassMethod(Selector Sel) { ObjCMethodDecl *MethodDecl = NULL; - if ((MethodDecl = getClassMethod(Context, Sel))) + if ((MethodDecl = getClassMethod(Sel))) return MethodDecl; for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupClassMethod(Context, Sel))) + if ((MethodDecl = (*I)->lookupClassMethod(Sel))) return MethodDecl; return NULL; } @@ -555,11 +541,10 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC, } -void ObjCImplDecl::addPropertyImplementation(ASTContext &Context, - ObjCPropertyImplDecl *property) { +void ObjCImplDecl::addPropertyImplementation(ObjCPropertyImplDecl *property) { // FIXME: The context should be correct before we get here. property->setLexicalDeclContext(this); - addDecl(Context, property); + addDecl(property); } /// FindPropertyImplIvarDecl - This method lookup the ivar in the list of @@ -567,9 +552,8 @@ void ObjCImplDecl::addPropertyImplementation(ASTContext &Context, /// the implemented property that uses it. /// ObjCPropertyImplDecl *ObjCImplDecl:: -FindPropertyImplIvarDecl(ASTContext &Context, IdentifierInfo *ivarId) const { - for (propimpl_iterator i = propimpl_begin(Context), e = propimpl_end(Context); - i != e; ++i){ +FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const { + for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyIvarDecl() && PID->getPropertyIvarDecl()->getIdentifier() == ivarId) @@ -583,9 +567,8 @@ FindPropertyImplIvarDecl(ASTContext &Context, IdentifierInfo *ivarId) const { /// category @implementation block. /// ObjCPropertyImplDecl *ObjCImplDecl:: -FindPropertyImplDecl(ASTContext &Context, IdentifierInfo *Id) const { - for (propimpl_iterator i = propimpl_begin(Context), e = propimpl_end(Context); - i != e; ++i){ +FindPropertyImplDecl(IdentifierInfo *Id) const { + for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyDecl()->getIdentifier() == Id) return PID; @@ -596,8 +579,7 @@ FindPropertyImplDecl(ASTContext &Context, IdentifierInfo *Id) const { // getInstanceMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(ASTContext &Context, - Selector Sel) const { +ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(Selector Sel) const { // Since instance & class methods can have the same name, the loop below // ensures we get the correct method. // @@ -607,7 +589,7 @@ ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(ASTContext &Context, // @end // lookup_const_iterator Meth, MethEnd; - for (llvm::tie(Meth, MethEnd) = lookup(Context, Sel); + for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) { ObjCMethodDecl *MD = dyn_cast(*Meth); if (MD && MD->isInstanceMethod()) @@ -619,8 +601,7 @@ ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(ASTContext &Context, // getClassMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjCMethodDecl *ObjCImplDecl::getClassMethod(ASTContext &Context, - Selector Sel) const { +ObjCMethodDecl *ObjCImplDecl::getClassMethod(Selector Sel) const { // Since instance & class methods can have the same name, the loop below // ensures we get the correct method. // @@ -630,7 +611,7 @@ ObjCMethodDecl *ObjCImplDecl::getClassMethod(ASTContext &Context, // @end // lookup_const_iterator Meth, MethEnd; - for (llvm::tie(Meth, MethEnd) = lookup(Context, Sel); + for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) { ObjCMethodDecl *MD = dyn_cast(*Meth); if (MD && MD->isClassMethod()) diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index b46656ad3c..ca25ed2dba 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -171,8 +171,7 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { Indentation += Policy.Indentation; llvm::SmallVector Decls; - for (DeclContext::decl_iterator D = DC->decls_begin(Context), - DEnd = DC->decls_end(Context); + for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end(); D != DEnd; ++D) { if (!Policy.Dump) { // Skip over implicit declarations in pretty-printing mode. @@ -501,7 +500,7 @@ void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) { VisitDeclContext(D); Indent() << "}"; } else - Visit(*D->decls_begin(Context)); + Visit(*D->decls_begin()); } void DeclPrinter::VisitTemplateDecl(TemplateDecl *D) { diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 9d765924e0..4a9c420cb9 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -242,8 +242,8 @@ APValue LValueExprEvaluator::VisitMemberExpr(MemberExpr *E) { // FIXME: This is linear time. unsigned i = 0; - for (RecordDecl::field_iterator Field = RD->field_begin(Info.Ctx), - FieldEnd = RD->field_end(Info.Ctx); + for (RecordDecl::field_iterator Field = RD->field_begin(), + FieldEnd = RD->field_end(); Field != FieldEnd; (void)++Field, ++i) { if (*Field == FD) break; diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 619dbe537d..3cca482633 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -156,13 +156,13 @@ static bool followsFundamentalRule(Selector S) { } static const ObjCMethodDecl* -ResolveToInterfaceMethodDecl(const ObjCMethodDecl *MD, ASTContext &Context) { +ResolveToInterfaceMethodDecl(const ObjCMethodDecl *MD) { ObjCInterfaceDecl *ID = const_cast(MD->getClassInterface()); return MD->isInstanceMethod() - ? ID->lookupInstanceMethod(Context, MD->getSelector()) - : ID->lookupClassMethod(Context, MD->getSelector()); + ? ID->lookupInstanceMethod(MD->getSelector()) + : ID->lookupClassMethod(MD->getSelector()); } namespace { @@ -827,8 +827,7 @@ public: QualType ResultTy = MD->getResultType(); // Resolve the method decl last. - if (const ObjCMethodDecl *InterfaceMD = - ResolveToInterfaceMethodDecl(MD, Ctx)) + if (const ObjCMethodDecl *InterfaceMD = ResolveToInterfaceMethodDecl(MD)) MD = InterfaceMD; if (MD->isInstanceMethod()) @@ -2857,8 +2856,8 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, state->getStateManager().getRegionManager(); // Iterate through the fields and construct new symbols. - for (RecordDecl::field_iterator FI=RD->field_begin(Ctx), - FE=RD->field_end(Ctx); FI!=FE; ++FI) { + for (RecordDecl::field_iterator FI=RD->field_begin(), + FE=RD->field_end(); FI!=FE; ++FI) { // For now just handle scalar fields. FieldDecl *FD = *FI; diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp index e5f0485d8e..a14ae26512 100644 --- a/lib/Analysis/CheckObjCDealloc.cpp +++ b/lib/Analysis/CheckObjCDealloc.cpp @@ -147,8 +147,8 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, ObjCMethodDecl* MD = 0; // Scan the instance methods for "dealloc". - for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(Ctx), - E = D->instmeth_end(Ctx); I!=E; ++I) { + for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(), + E = D->instmeth_end(); I!=E; ++I) { if ((*I)->getSelector() == S) { MD = *I; @@ -198,8 +198,8 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D, // Scan for missing and extra releases of ivars used by implementations // of synthesized properties - for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(Ctx), - E = D->propimpl_end(Ctx); I!=E; ++I) { + for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(), + E = D->propimpl_end(); I!=E; ++I) { // We can only check the synthesized properties if((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize) diff --git a/lib/Analysis/CheckObjCInstMethSignature.cpp b/lib/Analysis/CheckObjCInstMethSignature.cpp index 9fec7c1dc1..28814867bd 100644 --- a/lib/Analysis/CheckObjCInstMethSignature.cpp +++ b/lib/Analysis/CheckObjCInstMethSignature.cpp @@ -86,8 +86,8 @@ void clang::CheckObjCInstMethSignature(ObjCImplementationDecl* ID, MapTy IMeths; unsigned NumMethods = 0; - for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(Ctx), - E=ID->instmeth_end(Ctx); I!=E; ++I) { + for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(), + E=ID->instmeth_end(); I!=E; ++I) { ObjCMethodDecl* M = *I; IMeths[M->getSelector()] = M; @@ -97,8 +97,8 @@ void clang::CheckObjCInstMethSignature(ObjCImplementationDecl* ID, // Now recurse the class hierarchy chain looking for methods with the // same signatures. while (C && NumMethods) { - for (ObjCInterfaceDecl::instmeth_iterator I=C->instmeth_begin(Ctx), - E=C->instmeth_end(Ctx); I!=E; ++I) { + for (ObjCInterfaceDecl::instmeth_iterator I=C->instmeth_begin(), + E=C->instmeth_end(); I!=E; ++I) { ObjCMethodDecl* M = *I; Selector S = M->getSelector(); diff --git a/lib/Analysis/CheckObjCUnusedIVars.cpp b/lib/Analysis/CheckObjCUnusedIVars.cpp index bbcf90ec02..6764985d43 100644 --- a/lib/Analysis/CheckObjCUnusedIVars.cpp +++ b/lib/Analysis/CheckObjCUnusedIVars.cpp @@ -83,14 +83,14 @@ void clang::CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR) { return; // Now scan the methods for accesses. - for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(Ctx), - E = D->instmeth_end(Ctx); I!=E; ++I) + for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(), + E = D->instmeth_end(); I!=E; ++I) Scan(M, (*I)->getBody()); // Scan for @synthesized property methods that act as setters/getters // to an ivar. - for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(Ctx), - E = D->propimpl_end(Ctx); I!=E; ++I) + for (ObjCImplementationDecl::propimpl_iterator I = D->propimpl_begin(), + E = D->propimpl_end(); I!=E; ++I) Scan(M, *I); // Find ivars that are unused. diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 493f14d499..e9377577a4 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -1018,8 +1018,7 @@ SVal RegionStoreManager::RetrieveStruct(const GRState *state, // FIXME: We shouldn't use a std::vector. If RecordDecl doesn't have a // reverse iterator, we should implement one. - std::vector Fields(RD->field_begin(getContext()), - RD->field_end(getContext())); + std::vector Fields(RD->field_begin(), RD->field_end()); for (std::vector::reverse_iterator Field = Fields.rbegin(), FieldEnd = Fields.rend(); @@ -1207,8 +1206,7 @@ RegionStoreManager::BindStruct(const GRState *state, const TypedRegion* R, RecordDecl::field_iterator FI, FE; - for (FI = RD->field_begin(getContext()), FE = RD->field_end(getContext()); - FI != FE; ++FI, ++VI) { + for (FI = RD->field_begin(), FE = RD->field_end(); FI != FE; ++FI, ++VI) { if (VI == VE) break; diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 4f9a4caee6..5f3acea767 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -323,8 +323,8 @@ static bool canGenerateCXXstructor(const CXXRecordDecl *RD, if (RD->getNumBases() > 0) return false; - for (CXXRecordDecl::field_iterator I = RD->field_begin(Context), - E = RD->field_end(Context); I != E; ++I) { + for (CXXRecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); + I != E; ++I) { // We don't support ctors for fields that aren't POD. if (!I->getType()->isPODType()) return false; diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index b5195c4a54..97391bc620 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -142,8 +142,8 @@ void CodeGenTypes::GetExpandedTypes(QualType Ty, assert(!RD->hasFlexibleArrayMember() && "Cannot expand structure with flexible array."); - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { const FieldDecl *FD = *i; assert(!FD->isBitField() && "Cannot expand structure with bit-field members."); @@ -167,8 +167,8 @@ CodeGenFunction::ExpandTypeFromArgs(QualType Ty, LValue LV, assert(LV.isSimple() && "Unexpected non-simple lvalue during struct expansion."); llvm::Value *Addr = LV.getAddress(); - for (RecordDecl::field_iterator i = RD->field_begin(getContext()), - e = RD->field_end(getContext()); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { FieldDecl *FD = *i; QualType FT = FD->getType(); @@ -194,8 +194,8 @@ CodeGenFunction::ExpandTypeToArgs(QualType Ty, RValue RV, RecordDecl *RD = RT->getDecl(); assert(RV.isAggregate() && "Unexpected rvalue during struct expansion"); llvm::Value *Addr = RV.getAggregateAddr(); - for (RecordDecl::field_iterator i = RD->field_begin(getContext()), - e = RD->field_end(getContext()); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { FieldDecl *FD = *i; QualType FT = FD->getType(); diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 99c5188696..2bf8a222a2 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -437,8 +437,8 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, const ASTRecordLayout &RL = M->getContext().getASTRecordLayout(Decl); unsigned FieldNo = 0; - for (RecordDecl::field_iterator I = Decl->field_begin(M->getContext()), - E = Decl->field_end(M->getContext()); + for (RecordDecl::field_iterator I = Decl->field_begin(), + E = Decl->field_end(); I != E; ++I, ++FieldNo) { FieldDecl *Field = *I; llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit); @@ -638,8 +638,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty, // Create DIEnumerator elements for each enumerator. for (EnumDecl::enumerator_iterator - Enum = Decl->enumerator_begin(M->getContext()), - EnumEnd = Decl->enumerator_end(M->getContext()); + Enum = Decl->enumerator_begin(), EnumEnd = Decl->enumerator_end(); Enum != EnumEnd; ++Enum) { Enumerators.push_back(DebugFactory.CreateEnumerator(Enum->getNameAsString(), Enum->getInitVal().getZExtValue())); diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 4268ae3b17..412a06594f 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -436,8 +436,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { #ifndef NDEBUG // Make sure that it's really an empty and not a failure of // semantic analysis. - for (RecordDecl::field_iterator Field = SD->field_begin(CGF.getContext()), - FieldEnd = SD->field_end(CGF.getContext()); + for (RecordDecl::field_iterator Field = SD->field_begin(), + FieldEnd = SD->field_end(); Field != FieldEnd; ++Field) assert(Field->isUnnamedBitfield() && "Only unnamed bitfields allowed"); #endif @@ -461,8 +461,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // Here we iterate over the fields; this makes it simpler to both // default-initialize fields and skip over unnamed fields. - for (RecordDecl::field_iterator Field = SD->field_begin(CGF.getContext()), - FieldEnd = SD->field_end(CGF.getContext()); + for (RecordDecl::field_iterator Field = SD->field_begin(), + FieldEnd = SD->field_end(); Field != FieldEnd; ++Field) { // We're done once we hit the flexible array member if (Field->getType()->isIncompleteArrayType()) diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 0b109f9bee..37c9c366fe 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -199,8 +199,8 @@ public: // Copy initializer elements. Skip padding fields. unsigned EltNo = 0; // Element no in ILE bool RewriteType = false; - for (RecordDecl::field_iterator Field = RD->field_begin(CGM.getContext()), - FieldEnd = RD->field_end(CGM.getContext()); + for (RecordDecl::field_iterator Field = RD->field_begin(), + FieldEnd = RD->field_end(); EltNo < ILE->getNumInits() && Field != FieldEnd; ++Field) { if (Field->isBitField()) { if (!Field->getIdentifier()) @@ -263,8 +263,8 @@ public: // Make sure that it's really an empty and not a failure of // semantic analysis. RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl(); - for (RecordDecl::field_iterator Field = RD->field_begin(CGM.getContext()), - FieldEnd = RD->field_end(CGM.getContext()); + for (RecordDecl::field_iterator Field = RD->field_begin(), + FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) assert(Field->isUnnamedBitfield() && "Only unnamed bitfields allowed"); #endif diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 4f96b8baec..230017b2dc 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -739,8 +739,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { Protocols.push_back((*PI)->getNameAsString()); llvm::SmallVector InstanceMethodNames; llvm::SmallVector InstanceMethodTypes; - for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(Context), - E = PD->instmeth_end(Context); iter != E; iter++) { + for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(), + E = PD->instmeth_end(); iter != E; iter++) { std::string TypeStr; Context.getObjCEncodingForMethodDecl(*iter, TypeStr); InstanceMethodNames.push_back( @@ -751,8 +751,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { llvm::SmallVector ClassMethodNames; llvm::SmallVector ClassMethodTypes; for (ObjCProtocolDecl::classmeth_iterator - iter = PD->classmeth_begin(Context), - endIter = PD->classmeth_end(Context) ; iter != endIter ; iter++) { + iter = PD->classmeth_begin(), endIter = PD->classmeth_end(); + iter != endIter ; iter++) { std::string TypeStr; Context.getObjCEncodingForMethodDecl((*iter),TypeStr); ClassMethodNames.push_back( @@ -794,8 +794,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { llvm::SmallVector InstanceMethodSels; llvm::SmallVector InstanceMethodTypes; for (ObjCCategoryImplDecl::instmeth_iterator - iter = OCD->instmeth_begin(CGM.getContext()), - endIter = OCD->instmeth_end(CGM.getContext()); + iter = OCD->instmeth_begin(), endIter = OCD->instmeth_end(); iter != endIter ; iter++) { InstanceMethodSels.push_back((*iter)->getSelector()); std::string TypeStr; @@ -807,8 +806,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { llvm::SmallVector ClassMethodSels; llvm::SmallVector ClassMethodTypes; for (ObjCCategoryImplDecl::classmeth_iterator - iter = OCD->classmeth_begin(CGM.getContext()), - endIter = OCD->classmeth_end(CGM.getContext()); + iter = OCD->classmeth_begin(), endIter = OCD->classmeth_end(); iter != endIter ; iter++) { ClassMethodSels.push_back((*iter)->getSelector()); std::string TypeStr; @@ -906,8 +904,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { llvm::SmallVector InstanceMethodSels; llvm::SmallVector InstanceMethodTypes; for (ObjCImplementationDecl::instmeth_iterator - iter = OID->instmeth_begin(CGM.getContext()), - endIter = OID->instmeth_end(CGM.getContext()); + iter = OID->instmeth_begin(), endIter = OID->instmeth_end(); iter != endIter ; iter++) { InstanceMethodSels.push_back((*iter)->getSelector()); std::string TypeStr; @@ -915,8 +912,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { InstanceMethodTypes.push_back(CGM.GetAddrOfConstantCString(TypeStr)); } for (ObjCImplDecl::propimpl_iterator - iter = OID->propimpl_begin(CGM.getContext()), - endIter = OID->propimpl_end(CGM.getContext()); + iter = OID->propimpl_begin(), endIter = OID->propimpl_end(); iter != endIter ; iter++) { ObjCPropertyDecl *property = (*iter)->getPropertyDecl(); if (ObjCMethodDecl *getter = property->getGetterMethodDecl()) { @@ -937,8 +933,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { llvm::SmallVector ClassMethodSels; llvm::SmallVector ClassMethodTypes; for (ObjCImplementationDecl::classmeth_iterator - iter = OID->classmeth_begin(CGM.getContext()), - endIter = OID->classmeth_end(CGM.getContext()); + iter = OID->classmeth_begin(), endIter = OID->classmeth_end(); iter != endIter ; iter++) { ClassMethodSels.push_back((*iter)->getSelector()); std::string TypeStr; diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index b9e8495596..2e162e81a8 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1585,8 +1585,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { std::vector InstanceMethods, ClassMethods; std::vector OptInstanceMethods, OptClassMethods; for (ObjCProtocolDecl::instmeth_iterator - i = PD->instmeth_begin(CGM.getContext()), - e = PD->instmeth_end(CGM.getContext()); i != e; ++i) { + i = PD->instmeth_begin(), e = PD->instmeth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; llvm::Constant *C = GetMethodDescriptionConstant(MD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { @@ -1597,8 +1596,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { } for (ObjCProtocolDecl::classmeth_iterator - i = PD->classmeth_begin(CGM.getContext()), - e = PD->classmeth_end(CGM.getContext()); i != e; ++i) { + i = PD->classmeth_begin(), e = PD->classmeth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; llvm::Constant *C = GetMethodDescriptionConstant(MD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { @@ -1772,8 +1770,8 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name, const ObjCContainerDecl *OCD, const ObjCCommonTypesHelper &ObjCTypes) { std::vector Properties, Prop(2); - for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(CGM.getContext()), - E = OCD->prop_end(CGM.getContext()); I != E; ++I) { + for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(), + E = OCD->prop_end(); I != E; ++I) { const ObjCPropertyDecl *PD = *I; Prop[0] = GetPropertyName(PD->getIdentifier()); Prop[1] = GetPropertyTypeString(PD, Container); @@ -1865,14 +1863,12 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { std::vector InstanceMethods, ClassMethods; for (ObjCCategoryImplDecl::instmeth_iterator - i = OCD->instmeth_begin(CGM.getContext()), - e = OCD->instmeth_end(CGM.getContext()); i != e; ++i) { + i = OCD->instmeth_begin(), e = OCD->instmeth_end(); i != e; ++i) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(*i)); } for (ObjCCategoryImplDecl::classmeth_iterator - i = OCD->classmeth_begin(CGM.getContext()), - e = OCD->classmeth_end(CGM.getContext()); i != e; ++i) { + i = OCD->classmeth_begin(), e = OCD->classmeth_end(); i != e; ++i) { // Class methods should always be defined. ClassMethods.push_back(GetMethodConstant(*i)); } @@ -1969,21 +1965,18 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { std::vector InstanceMethods, ClassMethods; for (ObjCImplementationDecl::instmeth_iterator - i = ID->instmeth_begin(CGM.getContext()), - e = ID->instmeth_end(CGM.getContext()); i != e; ++i) { + i = ID->instmeth_begin(), e = ID->instmeth_end(); i != e; ++i) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(*i)); } for (ObjCImplementationDecl::classmeth_iterator - i = ID->classmeth_begin(CGM.getContext()), - e = ID->classmeth_end(CGM.getContext()); i != e; ++i) { + i = ID->classmeth_begin(), e = ID->classmeth_end(); i != e; ++i) { // Class methods should always be defined. ClassMethods.push_back(GetMethodConstant(*i)); } for (ObjCImplementationDecl::propimpl_iterator - i = ID->propimpl_begin(CGM.getContext()), - e = ID->propimpl_end(CGM.getContext()); i != e; ++i) { + i = ID->propimpl_begin(), e = ID->propimpl_end(); i != e; ++i) { ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize) { @@ -2983,8 +2976,7 @@ void CGObjCCommonMac::BuildAggrIvarRecordLayout(const RecordType *RT, bool &HasUnion) { const RecordDecl *RD = RT->getDecl(); // FIXME - Use iterator. - llvm::SmallVector Fields(RD->field_begin(CGM.getContext()), - RD->field_end(CGM.getContext())); + llvm::SmallVector Fields(RD->field_begin(), RD->field_end()); const llvm::Type *Ty = CGM.getTypes().ConvertType(QualType(RT, 0)); const llvm::StructLayout *RecLayout = CGM.getTargetData().getStructLayout(cast(Ty)); @@ -3528,9 +3520,9 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(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, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, Ctx.getObjCIdType(), 0, false)); - RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, Ctx.getObjCClassType(), 0, false)); RD->completeDefinition(Ctx); @@ -3987,9 +3979,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct, 0, SourceLocation(), &Ctx.Idents.get("_message_ref_t")); - RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, Ctx.VoidPtrTy, 0, false)); - RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, Ctx.getObjCSelType(), 0, false)); RD->completeDefinition(Ctx); @@ -4190,22 +4182,19 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( if (flags & CLS_META) { MethodListName += "CLASS_METHODS_" + ID->getNameAsString(); for (ObjCImplementationDecl::classmeth_iterator - i = ID->classmeth_begin(CGM.getContext()), - e = ID->classmeth_end(CGM.getContext()); i != e; ++i) { + i = ID->classmeth_begin(), e = ID->classmeth_end(); i != e; ++i) { // Class methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } } else { MethodListName += "INSTANCE_METHODS_" + ID->getNameAsString(); for (ObjCImplementationDecl::instmeth_iterator - i = ID->instmeth_begin(CGM.getContext()), - e = ID->instmeth_end(CGM.getContext()); i != e; ++i) { + i = ID->instmeth_begin(), e = ID->instmeth_end(); i != e; ++i) { // Instance methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } for (ObjCImplementationDecl::propimpl_iterator - i = ID->propimpl_begin(CGM.getContext()), - e = ID->propimpl_end(CGM.getContext()); i != e; ++i) { + i = ID->propimpl_begin(), e = ID->propimpl_end(); i != e; ++i) { ObjCPropertyImplDecl *PID = *i; if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize){ @@ -4298,7 +4287,7 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassMetaData( bool CGObjCNonFragileABIMac::ImplementationIsNonLazy(const ObjCImplDecl *OD) const { - return OD->getClassMethod(CGM.getContext(), GetNullarySelector("load")) != 0; + return OD->getClassMethod(GetNullarySelector("load")) != 0; } void CGObjCNonFragileABIMac::GetClassSizeInfo(const ObjCImplementationDecl *OID, @@ -4478,8 +4467,7 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { "_$_" + OCD->getNameAsString(); for (ObjCCategoryImplDecl::instmeth_iterator - i = OCD->instmeth_begin(CGM.getContext()), - e = OCD->instmeth_end(CGM.getContext()); i != e; ++i) { + i = OCD->instmeth_begin(), e = OCD->instmeth_end(); i != e; ++i) { // Instance methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } @@ -4493,8 +4481,7 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { OCD->getNameAsString(); Methods.clear(); for (ObjCCategoryImplDecl::classmeth_iterator - i = OCD->classmeth_begin(CGM.getContext()), - e = OCD->classmeth_end(CGM.getContext()); i != e; ++i) { + i = OCD->classmeth_begin(), e = OCD->classmeth_end(); i != e; ++i) { // Class methods should always be defined. Methods.push_back(GetMethodConstant(*i)); } @@ -4782,9 +4769,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( std::vector InstanceMethods, ClassMethods; std::vector OptInstanceMethods, OptClassMethods; for (ObjCProtocolDecl::instmeth_iterator - i = PD->instmeth_begin(CGM.getContext()), - e = PD->instmeth_end(CGM.getContext()); - i != e; ++i) { + i = PD->instmeth_begin(), e = PD->instmeth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; llvm::Constant *C = GetMethodDescriptionConstant(MD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { @@ -4795,9 +4780,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( } for (ObjCProtocolDecl::classmeth_iterator - i = PD->classmeth_begin(CGM.getContext()), - e = PD->classmeth_end(CGM.getContext()); - i != e; ++i) { + i = PD->classmeth_begin(), e = PD->classmeth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; llvm::Constant *C = GetMethodDescriptionConstant(MD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index f5a985628b..d88a37a45b 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1262,7 +1262,7 @@ GetAddrOfConstantCFString(const StringLiteral *Literal) { cast(getTypes().ConvertType(CFTy)); std::vector Fields; - RecordDecl::field_iterator Field = CFRD->field_begin(getContext()); + RecordDecl::field_iterator Field = CFRD->field_begin(); // Class pointer. FieldDecl *CurField = *Field++; @@ -1432,8 +1432,7 @@ llvm::Constant *CodeGenModule::GetAddrOfConstantCString(const std::string &str, void CodeGenModule::EmitObjCPropertyImplementations(const ObjCImplementationDecl *D) { for (ObjCImplementationDecl::propimpl_iterator - i = D->propimpl_begin(getContext()), - e = D->propimpl_end(getContext()); i != e; ++i) { + i = D->propimpl_begin(), e = D->propimpl_end(); i != e; ++i) { ObjCPropertyImplDecl *PID = *i; // Dynamic is just for type-checking. @@ -1445,11 +1444,11 @@ void CodeGenModule::EmitObjCPropertyImplementations(const // we want, that just indicates if the decl came from a // property. What we want to know is if the method is defined in // this implementation. - if (!D->getInstanceMethod(getContext(), PD->getGetterName())) + if (!D->getInstanceMethod(PD->getGetterName())) CodeGenFunction(*this).GenerateObjCGetter( const_cast(D), PID); if (!PD->isReadOnly() && - !D->getInstanceMethod(getContext(), PD->getSetterName())) + !D->getInstanceMethod(PD->getSetterName())) CodeGenFunction(*this).GenerateObjCSetter( const_cast(D), PID); } @@ -1458,8 +1457,7 @@ void CodeGenModule::EmitObjCPropertyImplementations(const /// EmitNamespace - Emit all declarations in a namespace. void CodeGenModule::EmitNamespace(const NamespaceDecl *ND) { - for (RecordDecl::decl_iterator I = ND->decls_begin(getContext()), - E = ND->decls_end(getContext()); + for (RecordDecl::decl_iterator I = ND->decls_begin(), E = ND->decls_end(); I != E; ++I) EmitTopLevelDecl(*I); } @@ -1471,8 +1469,7 @@ void CodeGenModule::EmitLinkageSpec(const LinkageSpecDecl *LSD) { return; } - for (RecordDecl::decl_iterator I = LSD->decls_begin(getContext()), - E = LSD->decls_end(getContext()); + for (RecordDecl::decl_iterator I = LSD->decls_begin(), E = LSD->decls_end(); I != E; ++I) EmitTopLevelDecl(*I); } diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index f31c610bf9..1a30ea37fb 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -449,7 +449,7 @@ const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) { const RecordDecl *RD = cast(TD); // There isn't any extra information for empty structures/unions. - if (RD->field_empty(getContext())) { + if (RD->field_empty()) { ResultType = llvm::StructType::get(std::vector()); } else { // Layout fields. @@ -532,8 +532,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { std::vector LLVMFields; unsigned curField = 0; - for (RecordDecl::field_iterator Field = RD.field_begin(CGT.getContext()), - FieldEnd = RD.field_end(CGT.getContext()); + for (RecordDecl::field_iterator Field = RD.field_begin(), + FieldEnd = RD.field_end(); Field != FieldEnd; ++Field) { uint64_t offset = RL.getFieldOffset(curField); const llvm::Type *Ty = CGT.ConvertTypeForMemRecursive(Field->getType()); @@ -578,8 +578,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { /// all fields are added. void RecordOrganizer::layoutUnionFields(const ASTRecordLayout &RL) { unsigned curField = 0; - for (RecordDecl::field_iterator Field = RD.field_begin(CGT.getContext()), - FieldEnd = RD.field_end(CGT.getContext()); + for (RecordDecl::field_iterator Field = RD.field_begin(), + FieldEnd = RD.field_end(); Field != FieldEnd; ++Field) { // The offset should usually be zero, but bitfields could be strange uint64_t offset = RL.getFieldOffset(curField); diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp index 361e5c0005..896dbd6850 100644 --- a/lib/CodeGen/TargetABIInfo.cpp +++ b/lib/CodeGen/TargetABIInfo.cpp @@ -74,8 +74,8 @@ static bool isEmptyRecord(ASTContext &Context, QualType T) { const RecordDecl *RD = RT->getDecl(); if (RD->hasFlexibleArrayMember()) return false; - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) if (!isEmptyField(Context, *i)) return false; return true; @@ -99,8 +99,8 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) { return 0; const Type *Found = 0; - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { const FieldDecl *FD = *i; QualType FT = FD->getType(); @@ -142,8 +142,8 @@ static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) { static bool areAllFields32Or64BitBasicType(const RecordDecl *RD, ASTContext &Context) { - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { const FieldDecl *FD = *i; if (!is32Or64BitBasicType(FD->getType(), Context)) @@ -160,8 +160,8 @@ static bool areAllFields32Or64BitBasicType(const RecordDecl *RD, } static bool typeContainsSSEVector(const RecordDecl *RD, ASTContext &Context) { - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { const FieldDecl *FD = *i; if (FD->getType()->isVectorType() && @@ -269,8 +269,8 @@ bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty, // Structure types are passed in register if all fields would be // passed in a register. - for (RecordDecl::field_iterator i = RT->getDecl()->field_begin(Context), - e = RT->getDecl()->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RT->getDecl()->field_begin(), + e = RT->getDecl()->field_end(); i != e; ++i) { const FieldDecl *FD = *i; // Empty fields are ignored. @@ -707,8 +707,8 @@ void X86_64ABIInfo::classify(QualType Ty, // Reset Lo class, this will be recomputed. Current = NoClass; unsigned idx = 0; - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i, ++idx) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i, ++idx) { uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx); bool BitField = i->isBitField(); diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index 97d6d0e96d..51e376ffe0 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -70,8 +70,8 @@ namespace { virtual void HandleTranslationUnit(ASTContext &Ctx) { Doc.addSubNode("TranslationUnit"); for (DeclContext::decl_iterator - D = Ctx.getTranslationUnitDecl()->decls_begin(Ctx), - DEnd = Ctx.getTranslationUnitDecl()->decls_end(Ctx); + D = Ctx.getTranslationUnitDecl()->decls_begin(), + DEnd = Ctx.getTranslationUnitDecl()->decls_end(); D != DEnd; ++D) { @@ -342,8 +342,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, // Print decls in the DeclContext. // FIXME: Should not use a NULL DeclContext! ASTContext *Context = 0; - for (DeclContext::decl_iterator I = DC->decls_begin(*Context), - E = DC->decls_end(*Context); + for (DeclContext::decl_iterator I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) { for (unsigned i = 0; i < Indentation; ++i) Out << " "; diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index 3bdd0cacd7..06af2d9a4e 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -341,8 +341,8 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) { if (!ObjCImplementationActions.empty()) { TranslationUnitDecl *TUD = C.getTranslationUnitDecl(); - for (DeclContext::decl_iterator I = TUD->decls_begin(C), - E = TUD->decls_end(C); + for (DeclContext::decl_iterator I = TUD->decls_begin(), + E = TUD->decls_end(); I != E; ++I) if (ObjCImplementationDecl* ID = dyn_cast(*I)) HandleCode(ID, 0, ObjCImplementationActions); diff --git a/lib/Frontend/DeclXML.cpp b/lib/Frontend/DeclXML.cpp index dcc9ceaa66..68f931fb6c 100644 --- a/lib/Frontend/DeclXML.cpp +++ b/lib/Frontend/DeclXML.cpp @@ -34,8 +34,8 @@ class DocumentXML::DeclPrinter : public DeclVisitor void addSubNodes(RecordDecl* RD) { - for (RecordDecl::field_iterator i = RD->field_begin(*Doc.Ctx), e = RD->field_end(*Doc.Ctx); i != e; ++i) - { + for (RecordDecl::field_iterator i = RD->field_begin(), + e = RD->field_end(); i != e; ++i) { Visit(*i); Doc.toParent(); } @@ -43,8 +43,8 @@ class DocumentXML::DeclPrinter : public DeclVisitor void addSubNodes(EnumDecl* ED) { - for (EnumDecl::enumerator_iterator i = ED->enumerator_begin(*Doc.Ctx), e = ED->enumerator_end(*Doc.Ctx); i != e; ++i) - { + for (EnumDecl::enumerator_iterator i = ED->enumerator_begin(), + e = ED->enumerator_end(); i != e; ++i) { Visit(*i); Doc.toParent(); } diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index e93219e01d..41a5025455 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -1064,14 +1064,13 @@ void PCHWriter::WriteTypesBlock(ASTContext &Context) { /// bistream, or 0 if no block was written. uint64_t PCHWriter::WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC) { - if (DC->decls_empty(Context)) + if (DC->decls_empty()) return 0; uint64_t Offset = Stream.GetCurrentBitNo(); RecordData Record; - for (DeclContext::decl_iterator D = DC->decls_begin(Context), - DEnd = DC->decls_end(Context); - D != DEnd; ++D) + for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end(); + D != DEnd; ++D) AddDeclRef(*D, Record); ++NumLexicalDeclContexts; @@ -1097,7 +1096,7 @@ uint64_t PCHWriter::WriteDeclContextVisibleBlock(ASTContext &Context, return 0; // Force the DeclContext to build a its name-lookup table. - DC->lookup(Context, DeclarationName()); + DC->lookup(DeclarationName()); // Serialize the contents of the mapping used for lookup. Note that, // although we have two very different code paths, the serialized diff --git a/lib/Frontend/ResolveLocation.cpp b/lib/Frontend/ResolveLocation.cpp index 3908e89466..d7a9b4852a 100644 --- a/lib/Frontend/ResolveLocation.cpp +++ b/lib/Frontend/ResolveLocation.cpp @@ -163,7 +163,7 @@ void StmtLocResolver::VisitStmt(Stmt *Node) { void DeclLocResolver::VisitDeclContext(DeclContext *DC) { DeclLocResolver DLR(Ctx, Loc); for (DeclContext::decl_iterator - I = DC->decls_begin(Ctx), E = DC->decls_end(Ctx); I != E; ++I) { + I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) { DLR.Visit(*I); if (DLR.Finished()) { if (DLR.FoundIt()) diff --git a/lib/Frontend/RewriteBlocks.cpp b/lib/Frontend/RewriteBlocks.cpp index 29590de851..bc855fa879 100644 --- a/lib/Frontend/RewriteBlocks.cpp +++ b/lib/Frontend/RewriteBlocks.cpp @@ -306,39 +306,33 @@ void RewriteBlocks::RewriteMethodDecl(ObjCMethodDecl *Method) { void RewriteBlocks::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { for (ObjCInterfaceDecl::instmeth_iterator - I = ClassDecl->instmeth_begin(*Context), - E = ClassDecl->instmeth_end(*Context); + I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end(); I != E; ++I) RewriteMethodDecl(*I); for (ObjCInterfaceDecl::classmeth_iterator - I = ClassDecl->classmeth_begin(*Context), - E = ClassDecl->classmeth_end(*Context); + I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end(); I != E; ++I) RewriteMethodDecl(*I); } void RewriteBlocks::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { for (ObjCCategoryDecl::instmeth_iterator - I = CatDecl->instmeth_begin(*Context), - E = CatDecl->instmeth_end(*Context); + I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end(); I != E; ++I) RewriteMethodDecl(*I); for (ObjCCategoryDecl::classmeth_iterator - I = CatDecl->classmeth_begin(*Context), - E = CatDecl->classmeth_end(*Context); + I = CatDecl->classmeth_begin(), E = CatDecl->classmeth_end(); I != E; ++I) RewriteMethodDecl(*I); } void RewriteBlocks::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { for (ObjCProtocolDecl::instmeth_iterator - I = PDecl->instmeth_begin(*Context), - E = PDecl->instmeth_end(*Context); + I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) RewriteMethodDecl(*I); for (ObjCProtocolDecl::classmeth_iterator - I = PDecl->classmeth_begin(*Context), - E = PDecl->classmeth_end(*Context); + I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) RewriteMethodDecl(*I); } @@ -1147,8 +1141,8 @@ void RewriteBlocks::HandleDeclInMainFile(Decl *D) { } if (RecordDecl *RD = dyn_cast(D)) { if (RD->isDefinition()) { - for (RecordDecl::field_iterator i = RD->field_begin(*Context), - e = RD->field_end(*Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), + e = RD->field_end(); i != e; ++i) { FieldDecl *FD = *i; if (isBlockPointerType(FD->getType())) RewriteBlockPointerDecl(FD); diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index a48e8e6eba..cf31f2b2de 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -597,8 +597,8 @@ void RewriteObjC::HandleTopLevelSingleDecl(Decl *D) { RewriteForwardProtocolDecl(FP); } else if (LinkageSpecDecl *LSD = dyn_cast(D)) { // Recurse into linkage specifications - for (DeclContext::decl_iterator DI = LSD->decls_begin(*Context), - DIEnd = LSD->decls_end(*Context); + for (DeclContext::decl_iterator DI = LSD->decls_begin(), + DIEnd = LSD->decls_end(); DI != DIEnd; ++DI) HandleTopLevelSingleDecl(*DI); } @@ -789,13 +789,11 @@ void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { ReplaceText(LocStart, 0, "// ", 3); for (ObjCCategoryDecl::instmeth_iterator - I = CatDecl->instmeth_begin(*Context), - E = CatDecl->instmeth_end(*Context); + I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); for (ObjCCategoryDecl::classmeth_iterator - I = CatDecl->classmeth_begin(*Context), - E = CatDecl->classmeth_end(*Context); + I = CatDecl->classmeth_begin(), E = CatDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -812,13 +810,11 @@ void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { ReplaceText(LocStart, 0, "// ", 3); for (ObjCProtocolDecl::instmeth_iterator - I = PDecl->instmeth_begin(*Context), - E = PDecl->instmeth_end(*Context); + I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); for (ObjCProtocolDecl::classmeth_iterator - I = PDecl->classmeth_begin(*Context), - E = PDecl->classmeth_end(*Context); + I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -986,8 +982,8 @@ void RewriteObjC::RewriteImplementationDecl(Decl *OID) { InsertText(CID->getLocStart(), "// ", 3); for (ObjCCategoryImplDecl::instmeth_iterator - I = IMD ? IMD->instmeth_begin(*Context) : CID->instmeth_begin(*Context), - E = IMD ? IMD->instmeth_end(*Context) : CID->instmeth_end(*Context); + I = IMD ? IMD->instmeth_begin() : CID->instmeth_begin(), + E = IMD ? IMD->instmeth_end() : CID->instmeth_end(); I != E; ++I) { std::string ResultStr; ObjCMethodDecl *OMD = *I; @@ -1002,8 +998,8 @@ void RewriteObjC::RewriteImplementationDecl(Decl *OID) { } for (ObjCCategoryImplDecl::classmeth_iterator - I = IMD ? IMD->classmeth_begin(*Context) : CID->classmeth_begin(*Context), - E = IMD ? IMD->classmeth_end(*Context) : CID->classmeth_end(*Context); + I = IMD ? IMD->classmeth_begin() : CID->classmeth_begin(), + E = IMD ? IMD->classmeth_end() : CID->classmeth_end(); I != E; ++I) { std::string ResultStr; ObjCMethodDecl *OMD = *I; @@ -1017,8 +1013,8 @@ void RewriteObjC::RewriteImplementationDecl(Decl *OID) { ResultStr.c_str(), ResultStr.size()); } for (ObjCCategoryImplDecl::propimpl_iterator - I = IMD ? IMD->propimpl_begin(*Context) : CID->propimpl_begin(*Context), - E = IMD ? IMD->propimpl_end(*Context) : CID->propimpl_end(*Context); + I = IMD ? IMD->propimpl_begin() : CID->propimpl_begin(), + E = IMD ? IMD->propimpl_end() : CID->propimpl_end(); I != E; ++I) { RewritePropertyImplDecl(*I, IMD, CID); } @@ -1047,17 +1043,15 @@ void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { } SynthesizeObjCInternalStruct(ClassDecl, ResultStr); - for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(*Context), - E = ClassDecl->prop_end(*Context); I != E; ++I) + for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(), + E = ClassDecl->prop_end(); I != E; ++I) RewriteProperty(*I); for (ObjCInterfaceDecl::instmeth_iterator - I = ClassDecl->instmeth_begin(*Context), - E = ClassDecl->instmeth_end(*Context); + I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); for (ObjCInterfaceDecl::classmeth_iterator - I = ClassDecl->classmeth_begin(*Context), - E = ClassDecl->classmeth_end(*Context); + I = ClassDecl->classmeth_begin(), E = ClassDecl->classmeth_end(); I != E; ++I) RewriteMethodDeclaration(*I); @@ -1149,8 +1143,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, dyn_cast(pType->getPointeeType()); // lookup which class implements the instance variable. ObjCInterfaceDecl *clsDeclared = 0; - iFaceDecl->getDecl()->lookupInstanceVariable(*Context, - D->getIdentifier(), + iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(), clsDeclared); assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class"); @@ -1195,8 +1188,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, ObjCInterfaceType *iFaceDecl = dyn_cast(pType->getPointeeType()); // lookup which class implements the instance variable. ObjCInterfaceDecl *clsDeclared = 0; - iFaceDecl->getDecl()->lookupInstanceVariable(*Context, - D->getIdentifier(), + iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(), clsDeclared); assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class"); @@ -2194,8 +2186,7 @@ QualType RewriteObjC::getSuperStructType() { // 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)); @@ -2224,8 +2215,7 @@ QualType RewriteObjC::getConstantStringStructType() { // 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], @@ -2891,9 +2881,9 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, if (ObjCSynthesizedProtocols.count(PDecl)) return; - if (PDecl->instmeth_begin(*Context) != PDecl->instmeth_end(*Context)) { - unsigned NumMethods = std::distance(PDecl->instmeth_begin(*Context), - PDecl->instmeth_end(*Context)); + if (PDecl->instmeth_begin() != PDecl->instmeth_end()) { + unsigned NumMethods = std::distance(PDecl->instmeth_begin(), + PDecl->instmeth_end()); /* struct _objc_protocol_method_list { int protocol_method_count; struct protocol_methods protocols[]; @@ -2910,10 +2900,9 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, // Output instance methods declared in this protocol. for (ObjCProtocolDecl::instmeth_iterator - I = PDecl->instmeth_begin(*Context), - E = PDecl->instmeth_end(*Context); + I = PDecl->instmeth_begin(), E = PDecl->instmeth_end(); I != E; ++I) { - if (I == PDecl->instmeth_begin(*Context)) + if (I == PDecl->instmeth_begin()) Result += "\t ,{{(struct objc_selector *)\""; else Result += "\t ,{(struct objc_selector *)\""; @@ -2928,8 +2917,8 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, } // Output class methods declared in this protocol. - unsigned NumMethods = std::distance(PDecl->classmeth_begin(*Context), - PDecl->classmeth_end(*Context)); + unsigned NumMethods = std::distance(PDecl->classmeth_begin(), + PDecl->classmeth_end()); if (NumMethods > 0) { /* struct _objc_protocol_method_list { int protocol_method_count; @@ -2949,10 +2938,9 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, // Output instance methods declared in this protocol. for (ObjCProtocolDecl::classmeth_iterator - I = PDecl->classmeth_begin(*Context), - E = PDecl->classmeth_end(*Context); + I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) { - if (I == PDecl->classmeth_begin(*Context)) + if (I == PDecl->classmeth_begin()) Result += "\t ,{{(struct objc_selector *)\""; else Result += "\t ,{(struct objc_selector *)\""; @@ -2995,14 +2983,14 @@ RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix, "{\n\t0, \""; Result += PDecl->getNameAsString(); Result += "\", 0, "; - if (PDecl->instmeth_begin(*Context) != PDecl->instmeth_end(*Context)) { + if (PDecl->instmeth_begin() != PDecl->instmeth_end()) { Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_INSTANCE_METHODS_"; Result += PDecl->getNameAsString(); Result += ", "; } else Result += "0, "; - if (PDecl->classmeth_begin(*Context) != PDecl->classmeth_end(*Context)) { + if (PDecl->classmeth_begin() != PDecl->classmeth_end()) { Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_CLASS_METHODS_"; Result += PDecl->getNameAsString(); Result += "\n"; @@ -3078,13 +3066,12 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, // Build _objc_method_list for class's instance methods if needed llvm::SmallVector - InstanceMethods(IDecl->instmeth_begin(*Context), - IDecl->instmeth_end(*Context)); + InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end()); // If any of our property implementations have associated getters or // setters, produce metadata for them as well. - for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(*Context), - PropEnd = IDecl->propimpl_end(*Context); + for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(), + PropEnd = IDecl->propimpl_end(); Prop != PropEnd; ++Prop) { if ((*Prop)->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) continue; @@ -3105,8 +3092,7 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, Result); // Build _objc_method_list for class's class methods if needed - RewriteObjCMethodsMetaData(IDecl->classmeth_begin(*Context), - IDecl->classmeth_end(*Context), + RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), false, "CATEGORY_", FullCategoryName.c_str(), Result); @@ -3149,7 +3135,7 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, Result += ClassDecl->getNameAsString(); Result += "\"\n"; - if (IDecl->instmeth_begin(*Context) != IDecl->instmeth_end(*Context)) { + if (IDecl->instmeth_begin() != IDecl->instmeth_end()) { Result += "\t, (struct _objc_method_list *)" "&_OBJC_CATEGORY_INSTANCE_METHODS_"; Result += FullCategoryName; @@ -3157,7 +3143,7 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, } else Result += "\t, 0\n"; - if (IDecl->classmeth_begin(*Context) != IDecl->classmeth_end(*Context)) { + if (IDecl->classmeth_begin() != IDecl->classmeth_end()) { Result += "\t, (struct _objc_method_list *)" "&_OBJC_CATEGORY_CLASS_METHODS_"; Result += FullCategoryName; @@ -3212,8 +3198,8 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, } // Build _objc_ivar_list metadata for classes ivars if needed - unsigned NumIvars = !IDecl->ivar_empty(*Context) - ? IDecl->ivar_size(*Context) + unsigned NumIvars = !IDecl->ivar_empty() + ? IDecl->ivar_size() : (CDecl ? CDecl->ivar_size() : 0); if (NumIvars > 0) { static bool objc_ivar = false; @@ -3251,10 +3237,9 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, ObjCInterfaceDecl::ivar_iterator IVI, IVE; llvm::SmallVector IVars; - if (!IDecl->ivar_empty(*Context)) { + if (!IDecl->ivar_empty()) { for (ObjCImplementationDecl::ivar_iterator - IV = IDecl->ivar_begin(*Context), - IVEnd = IDecl->ivar_end(*Context); + IV = IDecl->ivar_begin(), IVEnd = IDecl->ivar_end(); IV != IVEnd; ++IV) IVars.push_back(*IV); IVI = IVars.begin(); @@ -3291,13 +3276,12 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, // Build _objc_method_list for class's instance methods if needed llvm::SmallVector - InstanceMethods(IDecl->instmeth_begin(*Context), - IDecl->instmeth_end(*Context)); + InstanceMethods(IDecl->instmeth_begin(), IDecl->instmeth_end()); // If any of our property implementations have associated getters or // setters, produce metadata for them as well. - for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(*Context), - PropEnd = IDecl->propimpl_end(*Context); + for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(), + PropEnd = IDecl->propimpl_end(); Prop != PropEnd; ++Prop) { if ((*Prop)->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) continue; @@ -3317,8 +3301,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, true, "", IDecl->getNameAsCString(), Result); // Build _objc_method_list for class's class methods if needed - RewriteObjCMethodsMetaData(IDecl->classmeth_begin(*Context), - IDecl->classmeth_end(*Context), + RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(), false, "", IDecl->getNameAsCString(), Result); // Protocols referenced in class declaration? @@ -3391,7 +3374,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, // Set 'ivars' field for root class to 0. ObjC1 runtime does not use it. // 'info' field is initialized to CLS_META(2) for metaclass Result += ", 0,2, sizeof(struct _objc_class), 0"; - if (IDecl->classmeth_begin(*Context) != IDecl->classmeth_end(*Context)) { + if (IDecl->classmeth_begin() != IDecl->classmeth_end()) { Result += "\n\t, (struct _objc_method_list *)&_OBJC_CLASS_METHODS_"; Result += IDecl->getNameAsString(); Result += "\n"; @@ -3444,7 +3427,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, } else Result += ",0"; - if (IDecl->instmeth_begin(*Context) != IDecl->instmeth_end(*Context)) { + if (IDecl->instmeth_begin() != IDecl->instmeth_end()) { Result += ", (struct _objc_method_list *)&_OBJC_INSTANCE_METHODS_"; Result += CDecl->getNameAsString(); Result += ", 0\n\t"; @@ -4638,8 +4621,8 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { } if (RecordDecl *RD = dyn_cast(D)) { if (RD->isDefinition()) { - for (RecordDecl::field_iterator i = RD->field_begin(*Context), - e = RD->field_end(*Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), + e = RD->field_end(); i != e; ++i) { FieldDecl *FD = *i; if (isTopLevelBlockPointerType(FD->getType())) RewriteBlockPointerDecl(FD); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a0e125f0fc..1fd569729a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -273,7 +273,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S) { // Add scoped declarations into their context, so that they can be // found later. Declarations without a context won't be inserted // into any context. - CurContext->addDecl(Context, D); + CurContext->addDecl(D); // C++ [basic.scope]p4: // -- exactly one declaration shall declare a class name or @@ -1123,8 +1123,8 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) { bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner, RecordDecl *AnonRecord) { bool Invalid = false; - for (RecordDecl::field_iterator F = AnonRecord->field_begin(Context), - FEnd = AnonRecord->field_end(Context); + for (RecordDecl::field_iterator F = AnonRecord->field_begin(), + FEnd = AnonRecord->field_end(); F != FEnd; ++F) { if ((*F)->getDeclName()) { NamedDecl *PrevDecl = LookupQualifiedName(Owner, (*F)->getDeclName(), @@ -1147,7 +1147,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->makeDeclVisibleInContext(Context, *F); + Owner->makeDeclVisibleInContext(*F); S->AddDecl(DeclPtrTy::make(*F)); IdResolver.AddDecl(*F); } @@ -1213,8 +1213,8 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // The member-specification of an anonymous union shall only // define non-static data members. [Note: nested types and // functions cannot be declared within an anonymous union. ] - for (DeclContext::decl_iterator Mem = Record->decls_begin(Context), - MemEnd = Record->decls_end(Context); + for (DeclContext::decl_iterator Mem = Record->decls_begin(), + MemEnd = Record->decls_end(); Mem != MemEnd; ++Mem) { if (FieldDecl *FD = dyn_cast(*Mem)) { // C++ [class.union]p3: @@ -1302,7 +1302,7 @@ Sema::DeclPtrTy 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 @@ -3756,7 +3756,7 @@ CreateNewDecl: S = getNonFieldDeclScope(S); PushOnScopeChains(New, S); } else { - CurContext->addDecl(Context, New); + CurContext->addDecl(New); } OwnedDecl = true; @@ -3912,7 +3912,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, } else if (II) { PushOnScopeChains(NewFD, S); } else - Record->addDecl(Context, NewFD); + Record->addDecl(NewFD); return NewFD; } @@ -4234,7 +4234,7 @@ void Sema::ActOnFields(Scope* S, // Add ivar's to class's DeclContext. for (unsigned i = 0, e = RecFields.size(); i != e; ++i) { ClsFields[i]->setLexicalDeclContext(ID); - ID->addDecl(Context, ClsFields[i]); + ID->addDecl(ClsFields[i]); } // Must enforce the rule that ivars in the base classes may not be // duplicates. @@ -4245,7 +4245,7 @@ void Sema::ActOnFields(Scope* S, if (IdentifierInfo *II = Ivar->getIdentifier()) { ObjCIvarDecl* prevIvar = - ID->getSuperClass()->lookupInstanceVariable(Context, II); + ID->getSuperClass()->lookupInstanceVariable(II); if (prevIvar) { Diag(Ivar->getLocation(), diag::err_duplicate_member) << II; Diag(prevIvar->getLocation(), diag::note_previous_declaration); @@ -4544,7 +4544,7 @@ Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc, FileScopeAsmDecl *New = FileScopeAsmDecl::Create(Context, CurContext, Loc, AsmString); - CurContext->addDecl(Context, New); + CurContext->addDecl(New); return DeclPtrTy::make(New); } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index c5274f6801..2b71df7224 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1326,8 +1326,8 @@ static void HandleTransparentUnionAttr(Decl *d, const AttributeList &Attr, return; } - RecordDecl::field_iterator Field = RD->field_begin(S.Context), - FieldEnd = RD->field_end(S.Context); + RecordDecl::field_iterator Field = RD->field_begin(), + FieldEnd = RD->field_end(); if (Field == FieldEnd) { S.Diag(Attr.getLoc(), diag::warn_transparent_union_attribute_zero_fields); return; diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 1172d3e01b..f7c0ada6df 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -680,7 +680,7 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // Look for a member, first. FieldDecl *Member = 0; DeclContext::lookup_result Result - = ClassDecl->lookup(Context, MemberOrBase); + = ClassDecl->lookup(MemberOrBase); if (Result.first != Result.second) Member = dyn_cast(*Result.first); @@ -847,8 +847,7 @@ namespace { MethodSetTy OverriddenMethods; size_t MethodsSize = Methods.size(); - for (RecordDecl::decl_iterator i = RD->decls_begin(Context), - e = RD->decls_end(Context); + for (RecordDecl::decl_iterator i = RD->decls_begin(), e = RD->decls_end(); i != e; ++i) { // Traverse the record, looking for methods. if (CXXMethodDecl *MD = dyn_cast(*i)) { @@ -945,8 +944,8 @@ namespace { bool VisitDeclContext(const DeclContext *DC) { bool Invalid = false; - for (CXXRecordDecl::decl_iterator I = DC->decls_begin(SemaRef.Context), - E = DC->decls_end(SemaRef.Context); I != E; ++I) + for (CXXRecordDecl::decl_iterator I = DC->decls_begin(), + E = DC->decls_end(); I != E; ++I) Invalid |= Visit(*I); return Invalid; @@ -1022,8 +1021,8 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc, AbstractClassUsageDiagnoser(*this, RD); if (RD->hasTrivialConstructor() || RD->hasTrivialDestructor()) { - for (RecordDecl::field_iterator i = RD->field_begin(Context), - e = RD->field_end(Context); i != e; ++i) { + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); + i != e; ++i) { // All the nonstatic data members must have trivial constructors. QualType FTy = i->getType(); while (const ArrayType *AT = Context.getAsArrayType(FTy)) @@ -1080,7 +1079,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*isImplicitlyDeclared=*/true); DefaultCon->setAccess(AS_public); DefaultCon->setImplicit(); - ClassDecl->addDecl(Context, DefaultCon); + ClassDecl->addDecl(DefaultCon); } if (!ClassDecl->hasUserDeclaredCopyConstructor()) { @@ -1112,8 +1111,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // class type M (or array thereof), each such class type // has a copy constructor whose first parameter is of type // const M& or const volatile M&. - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - HasConstCopyConstructor && Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + HasConstCopyConstructor && Field != ClassDecl->field_end(); ++Field) { QualType FieldType = (*Field)->getType(); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -1157,7 +1156,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*IdentifierInfo=*/0, ArgType, VarDecl::None, 0); CopyConstructor->setParams(Context, &FromParam, 1); - ClassDecl->addDecl(Context, CopyConstructor); + ClassDecl->addDecl(CopyConstructor); } if (!ClassDecl->hasUserDeclaredCopyAssignment()) { @@ -1191,8 +1190,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // type M (or array thereof), each such class type has a copy // assignment operator whose parameter is of type const M&, // const volatile M& or M. - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - HasConstCopyAssignment && Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + HasConstCopyAssignment && Field != ClassDecl->field_end(); ++Field) { QualType FieldType = (*Field)->getType(); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -1236,7 +1235,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()) { @@ -1255,7 +1254,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*isImplicitlyDeclared=*/true); Destructor->setAccess(AS_public); Destructor->setImplicit(); - ClassDecl->addDecl(Context, Destructor); + ClassDecl->addDecl(Destructor); } } @@ -1798,7 +1797,7 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { // or translation unit scope. We add UsingDirectiveDecls, into // it's lookup structure. if (DeclContext *Ctx = static_cast(S->getEntity())) - Ctx->addDecl(Context, UDir); + Ctx->addDecl(UDir); else // Otherwise it is block-sope. using-directives will affect lookup // only to the end of scope. @@ -1899,7 +1898,7 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S, (NestedNameSpecifier *)SS.getScopeRep(), IdentLoc, R); - CurContext->addDecl(Context, AliasDecl); + CurContext->addDecl(AliasDecl); return DeclPtrTy::make(AliasDecl); } @@ -1935,8 +1934,8 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, } } } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2004,8 +2003,8 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, } } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2052,8 +2051,8 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation, getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl)) MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod); } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2139,9 +2138,9 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, BaseClassDecl->getCopyConstructor(Context, TypeQuals)) MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor); } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); - ++Field) { + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(), + FieldEnd = ClassDecl->field_end(); + Field != FieldEnd; ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) FieldType = Array->getElementType(); @@ -2308,7 +2307,7 @@ Sema::PerformInitializationByConstructor(QualType ClassType, = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType.getUnqualifiedType())); DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(Context, ConstructorName); + for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(ConstructorName); Con != ConEnd; ++Con) { CXXConstructorDecl *Constructor = cast(*Con); if ((Kind == IK_Direct) || @@ -2918,7 +2917,7 @@ Sema::DeclPtrTy 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 DeclPtrTy::make(D); } @@ -3032,7 +3031,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { if (II) PushOnScopeChains(ExDecl, S); else - CurContext->addDecl(Context, ExDecl); + CurContext->addDecl(ExDecl); ProcessDeclAttributes(S, ExDecl, D); return DeclPtrTy::make(ExDecl); @@ -3066,7 +3065,7 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc, Decl *Decl = StaticAssertDecl::Create(Context, CurContext, AssertLoc, AssertExpr, AssertMessage); - CurContext->addDecl(Context, Decl); + CurContext->addDecl(Decl); return DeclPtrTy::make(Decl); } diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 9013726e1a..5cf48d6da0 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -379,12 +379,12 @@ void Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) { if (!SDecl) return; // FIXME: O(N^2) - for (ObjCInterfaceDecl::prop_iterator S = SDecl->prop_begin(Context), - E = SDecl->prop_end(Context); S != E; ++S) { + for (ObjCInterfaceDecl::prop_iterator S = SDecl->prop_begin(), + E = SDecl->prop_end(); S != E; ++S) { ObjCPropertyDecl *SuperPDecl = (*S); // Does property in super class has declaration in current class? - for (ObjCInterfaceDecl::prop_iterator I = IDecl->prop_begin(Context), - E = IDecl->prop_end(Context); I != E; ++I) { + for (ObjCInterfaceDecl::prop_iterator I = IDecl->prop_begin(), + E = IDecl->prop_end(); I != E; ++I) { ObjCPropertyDecl *PDecl = (*I); if (SuperPDecl->getIdentifier() == PDecl->getIdentifier()) DiagnosePropertyMismatch(PDecl, SuperPDecl, @@ -404,13 +404,12 @@ Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl, // Category ObjCCategoryDecl *CatDecl = static_cast(CDecl); assert (CatDecl && "MergeOneProtocolPropertiesIntoClass"); - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(Context), - E = PDecl->prop_end(Context); P != E; ++P) { + for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), + E = PDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Pr = (*P); ObjCCategoryDecl::prop_iterator CP, CE; // Is this property already in category's list of properties? - for (CP = CatDecl->prop_begin(Context), CE = CatDecl->prop_end(Context); - CP != CE; ++CP) + for (CP = CatDecl->prop_begin(), CE = CatDecl->prop_end(); CP != CE; ++CP) if ((*CP)->getIdentifier() == Pr->getIdentifier()) break; if (CP != CE) @@ -419,13 +418,12 @@ Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl, } return; } - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(Context), - E = PDecl->prop_end(Context); P != E; ++P) { + for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), + E = PDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Pr = (*P); ObjCInterfaceDecl::prop_iterator CP, CE; // Is this property already in class's list of properties? - for (CP = IDecl->prop_begin(Context), CE = IDecl->prop_end(Context); - CP != CE; ++CP) + for (CP = IDecl->prop_begin(), CE = IDecl->prop_end(); CP != CE; ++CP) if ((*CP)->getIdentifier() == Pr->getIdentifier()) break; if (CP != CE) @@ -495,16 +493,16 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, return; // Possibly due to previous error llvm::DenseMap MethodMap; - for (ObjCInterfaceDecl::method_iterator i = ID->meth_begin(Context), - e = ID->meth_end(Context); i != e; ++i) { + for (ObjCInterfaceDecl::method_iterator i = ID->meth_begin(), + e = ID->meth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; MethodMap[MD->getSelector()] = MD; } if (MethodMap.empty()) return; - for (ObjCCategoryDecl::method_iterator i = CAT->meth_begin(Context), - e = CAT->meth_end(Context); i != e; ++i) { + for (ObjCCategoryDecl::method_iterator i = CAT->meth_begin(), + e = CAT->meth_end(); i != e; ++i) { ObjCMethodDecl *Method = *i; const ObjCMethodDecl *&PrevMethod = MethodMap[Method->getSelector()]; if (PrevMethod && !MatchTwoMethodDeclarations(Method, PrevMethod)) { @@ -539,7 +537,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 DeclPtrTy::make(PDecl); } @@ -555,7 +553,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, ObjCCategoryDecl *CDecl = ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, CategoryName); // FIXME: PushOnScopeChains? - CurContext->addDecl(Context, CDecl); + CurContext->addDecl(CDecl); ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); /// Check that class of this category is already completely declared. @@ -609,7 +607,7 @@ Sema::DeclPtrTy 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. @@ -808,7 +806,7 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, return false; // Even if property is ready only, if interface has a user defined setter, // it is not considered read only. - if (IDecl->getInstanceMethod(Context, PDecl->getSetterName())) + if (IDecl->getInstanceMethod(PDecl->getSetterName())) return false; // Main class has the property as 'readonly'. Must search @@ -818,10 +816,10 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, Category; Category = Category->getNextClassCategory()) { // Even if property is ready only, if a category has a user defined setter, // it is not considered read only. - if (Category->getInstanceMethod(Context, PDecl->getSetterName())) + if (Category->getInstanceMethod(PDecl->getSetterName())) return false; ObjCPropertyDecl *P = - Category->FindPropertyDeclaration(Context, PDecl->getIdentifier()); + Category->FindPropertyDeclaration(PDecl->getIdentifier()); if (P && !P->isReadOnly()) return false; } @@ -831,19 +829,19 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, if (ObjCMethodDecl *OMD = dyn_cast(CurContext)) { if (ObjCImplementationDecl *IMD = dyn_cast(OMD->getDeclContext())) { - if (IMD->getInstanceMethod(Context, PDecl->getSetterName())) + if (IMD->getInstanceMethod(PDecl->getSetterName())) return false; } else if (ObjCCategoryImplDecl *CIMD = dyn_cast(OMD->getDeclContext())) { - if (CIMD->getInstanceMethod(Context, PDecl->getSetterName())) + if (CIMD->getInstanceMethod(PDecl->getSetterName())) return false; } } // Lastly, look through the implementation (if one is in scope). if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(IDecl->getIdentifier())) - if (ImpDecl->getInstanceMethod(Context, PDecl->getSetterName())) + if (ImpDecl->getInstanceMethod(PDecl->getSetterName())) return false; // If all fails, look at the super class. if (ObjCInterfaceDecl *SIDecl = IDecl->getSuperClass()) @@ -890,31 +888,30 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, // check unimplemented instance methods. if (!NSIDecl) - for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(Context), - E = PDecl->instmeth_end(Context); I != E; ++I) { + for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), + E = PDecl->instmeth_end(); I != E; ++I) { ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && !method->isSynthesized() && !InsMap.count(method->getSelector()) && (!Super || - !Super->lookupInstanceMethod(Context, method->getSelector()))) { + !Super->lookupInstanceMethod(method->getSelector()))) { // Ugly, but necessary. Method declared in protcol might have // have been synthesized due to a property declared in the class which // uses the protocol. ObjCMethodDecl *MethodInClass = - IDecl->lookupInstanceMethod(Context, method->getSelector()); + IDecl->lookupInstanceMethod(method->getSelector()); if (!MethodInClass || !MethodInClass->isSynthesized()) WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); } } // check unimplemented class methods for (ObjCProtocolDecl::classmeth_iterator - I = PDecl->classmeth_begin(Context), - E = PDecl->classmeth_end(Context); + I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) { ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && !ClsMap.count(method->getSelector()) && - (!Super || !Super->lookupClassMethod(Context, method->getSelector()))) + (!Super || !Super->lookupClassMethod(method->getSelector()))) WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); } // Check on this protocols's referenced protocols, recursively. @@ -937,8 +934,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet &InsMap, { // Check and see if instance methods in class interface have been // implemented in the implementation class. If so, their types match. - for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(Context), - E = CDecl->instmeth_end(Context); I != E; ++I) { + for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(), + E = CDecl->instmeth_end(); I != E; ++I) { if (InsMapSeen.count((*I)->getSelector())) continue; InsMapSeen.insert((*I)->getSelector()); @@ -950,9 +947,9 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet &InsMap, } else { ObjCMethodDecl *ImpMethodDecl = - IMPDecl->getInstanceMethod(Context, (*I)->getSelector()); + IMPDecl->getInstanceMethod((*I)->getSelector()); ObjCMethodDecl *IntfMethodDecl = - CDecl->getInstanceMethod(Context, (*I)->getSelector()); + CDecl->getInstanceMethod((*I)->getSelector()); assert(IntfMethodDecl && "IntfMethodDecl is null in ImplMethodsVsClassMethods"); // ImpMethodDecl may be null as in a @dynamic property. @@ -964,9 +961,7 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet &InsMap, // Check and see if class methods in class interface have been // implemented in the implementation class. If so, their types match. for (ObjCInterfaceDecl::classmeth_iterator - I = CDecl->classmeth_begin(Context), - E = CDecl->classmeth_end(Context); - I != E; ++I) { + I = CDecl->classmeth_begin(), E = CDecl->classmeth_end(); I != E; ++I) { if (ClsMapSeen.count((*I)->getSelector())) continue; ClsMapSeen.insert((*I)->getSelector()); @@ -975,10 +970,10 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet &InsMap, WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl); } else { - ObjCMethodDecl *ImpMethodDecl = - IMPDecl->getClassMethod(Context, (*I)->getSelector()); + ObjCMethodDecl *ImpMethodDecl = + IMPDecl->getClassMethod((*I)->getSelector()); ObjCMethodDecl *IntfMethodDecl = - CDecl->getClassMethod(Context, (*I)->getSelector()); + CDecl->getClassMethod((*I)->getSelector()); WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl); } } @@ -1003,24 +998,23 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, // Check and see if instance methods in class interface have been // implemented in the implementation class. for (ObjCImplementationDecl::instmeth_iterator - I = IMPDecl->instmeth_begin(Context), - E = IMPDecl->instmeth_end(Context); I != E; ++I) + I = IMPDecl->instmeth_begin(), E = IMPDecl->instmeth_end(); I!=E; ++I) InsMap.insert((*I)->getSelector()); // Check and see if properties declared in the interface have either 1) // an implementation or 2) there is a @synthesize/@dynamic implementation // of the property in the @implementation. if (isa(CDecl)) - for (ObjCContainerDecl::prop_iterator P = CDecl->prop_begin(Context), - E = CDecl->prop_end(Context); P != E; ++P) { + for (ObjCContainerDecl::prop_iterator P = CDecl->prop_begin(), + E = CDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Prop = (*P); if (Prop->isInvalidDecl()) continue; ObjCPropertyImplDecl *PI = 0; // Is there a matching propery synthesize/dynamic? for (ObjCImplDecl::propimpl_iterator - I = IMPDecl->propimpl_begin(Context), - EI = IMPDecl->propimpl_end(Context); I != EI; ++I) + I = IMPDecl->propimpl_begin(), + EI = IMPDecl->propimpl_end(); I != EI; ++I) if ((*I)->getPropertyDecl() == Prop) { PI = (*I); break; @@ -1046,8 +1040,8 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, llvm::DenseSet ClsMap; for (ObjCImplementationDecl::classmeth_iterator - I = IMPDecl->classmeth_begin(Context), - E = IMPDecl->classmeth_end(Context); I != E; ++I) + I = IMPDecl->classmeth_begin(), + E = IMPDecl->classmeth_end(); I != E; ++I) ClsMap.insert((*I)->getSelector()); // Check for type conflict of methods declared in a class/protocol and @@ -1134,7 +1128,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 DeclPtrTy::make(CDecl); } @@ -1348,8 +1342,8 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *CD) { ObjCMethodDecl *GetterMethod, *SetterMethod; - GetterMethod = CD->getInstanceMethod(Context, property->getGetterName()); - SetterMethod = CD->getInstanceMethod(Context, property->getSetterName()); + GetterMethod = CD->getInstanceMethod(property->getGetterName()); + SetterMethod = CD->getInstanceMethod(property->getSetterName()); DiagnosePropertyAccessorMismatch(property, GetterMethod, property->getLocation()); @@ -1384,7 +1378,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 @@ -1415,7 +1409,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, VarDecl::None, 0); SetterMethod->setMethodParams(Context, &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 @@ -1481,7 +1475,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy 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); @@ -1498,7 +1492,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy 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); @@ -1524,8 +1518,8 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl, // ProcessPropertyDecl is responsible for diagnosing conflicts with any // user-defined setter/getter. It also synthesizes setter/getter methods // and adds them to the DeclContext and global method pools. - for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(Context), - E = CDecl->prop_end(Context); + for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(), + E = CDecl->prop_end(); I != E; ++I) ProcessPropertyDecl(*I, CDecl); CDecl->setAtEndLoc(AtEndLoc); @@ -1683,11 +1677,11 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( if (ObjCImplementationDecl *ImpDecl = dyn_cast(ClassDecl)) { if (MethodType == tok::minus) { - PrevMethod = ImpDecl->getInstanceMethod(Context, Sel); - ImpDecl->addInstanceMethod(Context, ObjCMethod); + PrevMethod = ImpDecl->getInstanceMethod(Sel); + ImpDecl->addInstanceMethod(ObjCMethod); } else { - PrevMethod = ImpDecl->getClassMethod(Context, Sel); - ImpDecl->addClassMethod(Context, ObjCMethod); + PrevMethod = ImpDecl->getClassMethod(Sel); + ImpDecl->addClassMethod(ObjCMethod); } if (AttrList) Diag(EndLoc, diag::warn_attribute_method_def); @@ -1695,11 +1689,11 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( else if (ObjCCategoryImplDecl *CatImpDecl = dyn_cast(ClassDecl)) { if (MethodType == tok::minus) { - PrevMethod = CatImpDecl->getInstanceMethod(Context, Sel); - CatImpDecl->addInstanceMethod(Context, ObjCMethod); + PrevMethod = CatImpDecl->getInstanceMethod(Sel); + CatImpDecl->addInstanceMethod(ObjCMethod); } else { - PrevMethod = CatImpDecl->getClassMethod(Context, Sel); - CatImpDecl->addClassMethod(Context, ObjCMethod); + PrevMethod = CatImpDecl->getClassMethod(Sel); + CatImpDecl->addClassMethod(ObjCMethod); } if (AttrList) Diag(EndLoc, diag::warn_attribute_method_def); @@ -1823,8 +1817,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCPropertyDecl *PIDecl = 0; IdentifierInfo *PropertyId = FD.D.getIdentifier(); for (ObjCInterfaceDecl::prop_iterator - I = CCPrimary->prop_begin(Context), - E = CCPrimary->prop_end(Context); + I = CCPrimary->prop_begin(), E = CCPrimary->prop_end(); I != E; ++I) if ((*I)->getIdentifier() == PropertyId) { PIDecl = *I; @@ -1870,7 +1863,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC, FD.D.getIdentifierLoc(), FD.D.getIdentifier(), T); - DC->addDecl(Context, PDecl); + DC->addDecl(PDecl); if (T->isArrayType() || T->isFunctionType()) { Diag(AtLoc, diag::err_property_type) << T; @@ -1951,7 +1944,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, "ActOnPropertyImplDecl - @implementation without @interface"); // Look for this property declaration in the @implementation's @interface - property = IDecl->FindPropertyDeclaration(Context, PropertyId); + property = IDecl->FindPropertyDeclaration(PropertyId); if (!property) { Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName(); return DeclPtrTy(); @@ -1975,7 +1968,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, if (!Category) return DeclPtrTy(); // Look for this property declaration in @implementation's category - property = Category->FindPropertyDeclaration(Context, PropertyId); + property = Category->FindPropertyDeclaration(PropertyId); if (!property) { Diag(PropertyLoc, diag::error_bad_category_property_decl) << Category->getDeclName(); @@ -1994,7 +1987,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, QualType PropType = Context.getCanonicalType(property->getType()); // Check that this is a previously declared 'ivar' in 'IDecl' interface ObjCInterfaceDecl *ClassDeclared; - Ivar = IDecl->lookupInstanceVariable(Context, PropertyIvar, ClassDeclared); + Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared); if (!Ivar) { DeclContext *EnclosingContext = cast_or_null(IDecl); assert(EnclosingContext && @@ -2004,7 +1997,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, ObjCIvarDecl::Public, (Expr *)0); Ivar->setLexicalDeclContext(IDecl); - IDecl->addDecl(Context, Ivar); + IDecl->addDecl(Ivar); property->setPropertyIvarDecl(Ivar); if (!getLangOptions().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; @@ -2071,7 +2064,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, if (IC) { if (Synthesize) if (ObjCPropertyImplDecl *PPIDecl = - IC->FindPropertyImplIvarDecl(Context, PropertyIvar)) { + IC->FindPropertyImplIvarDecl(PropertyIvar)) { Diag(PropertyLoc, diag::error_duplicate_ivar_use) << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() << PropertyIvar; @@ -2079,17 +2072,17 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, } if (ObjCPropertyImplDecl *PPIDecl - = IC->FindPropertyImplDecl(Context, PropertyId)) { + = IC->FindPropertyImplDecl(PropertyId)) { Diag(PropertyLoc, diag::error_property_implemented) << PropertyId; Diag(PPIDecl->getLocation(), diag::note_previous_declaration); return DeclPtrTy(); } - IC->addPropertyImplementation(Context, PIDecl); + IC->addPropertyImplementation(PIDecl); } else { if (Synthesize) if (ObjCPropertyImplDecl *PPIDecl = - CatImplClass->FindPropertyImplIvarDecl(Context, PropertyIvar)) { + CatImplClass->FindPropertyImplIvarDecl(PropertyIvar)) { Diag(PropertyLoc, diag::error_duplicate_ivar_use) << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() << PropertyIvar; @@ -2097,12 +2090,12 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, } if (ObjCPropertyImplDecl *PPIDecl = - CatImplClass->FindPropertyImplDecl(Context, PropertyId)) { + CatImplClass->FindPropertyImplDecl(PropertyId)) { Diag(PropertyLoc, diag::error_property_implemented) << PropertyId; Diag(PPIDecl->getLocation(), diag::note_previous_declaration); return DeclPtrTy(); } - CatImplClass->addPropertyImplementation(Context, PIDecl); + CatImplClass->addPropertyImplementation(PIDecl); } return DeclPtrTy::make(PIDecl); @@ -2154,7 +2147,7 @@ void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart, if (getLangOptions().CPlusPlus) PushOnScopeChains(cast(FD), S); else if (RecordDecl *Record = dyn_cast(TagD.getAs())) - Record->addDecl(Context, FD); + Record->addDecl(FD); } } diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 2102bed03b..28617bbfea 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -58,8 +58,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc) { if (ObjCImplementationDecl *Impl = dyn_cast(MD->getParent())) { - MD = Impl->getClassInterface()->getMethod(Context, - MD->getSelector(), + MD = Impl->getClassInterface()->getMethod(MD->getSelector(), MD->isInstanceMethod()); isSilenced |= MD && MD->getAttr(); } @@ -673,8 +672,8 @@ static Decl *getObjectForAnonymousRecordDecl(ASTContext &Context, // operation rather than a slow walk through DeclContext's vector (which // itself will be eliminated). DeclGroups might make this even better. DeclContext *Ctx = Record->getDeclContext(); - for (DeclContext::decl_iterator D = Ctx->decls_begin(Context), - DEnd = Ctx->decls_end(Context); + for (DeclContext::decl_iterator D = Ctx->decls_begin(), + DEnd = Ctx->decls_end(); D != DEnd; ++D) { if (*D == Record) { // The object for the anonymous struct/union directly @@ -877,8 +876,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, if (D == 0 || D->isDefinedOutsideFunctionOrMethod()) { ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface(); ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(Context, II, - ClassDeclared)) { + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) { // Check if referencing a field with __attribute__((deprecated)). if (DiagnoseUseOfDecl(IV, Loc)) return ExprError(); @@ -915,8 +913,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, // We should warn if a local variable hides an ivar. ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface(); ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(Context, II, - ClassDeclared)) { + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) { if (IV->getAccessControl() != ObjCIvarDecl::Private || IFace == ClassDeclared) Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName(); @@ -1989,9 +1986,9 @@ static Decl *FindGetterNameDeclFromProtocolList(const ObjCProtocolDecl*PDecl, const Selector &Sel, ASTContext &Context) { - if (ObjCPropertyDecl *PD = PDecl->FindPropertyDeclaration(Context, &Member)) + if (ObjCPropertyDecl *PD = PDecl->FindPropertyDeclaration(&Member)) return PD; - if (ObjCMethodDecl *OMD = PDecl->getInstanceMethod(Context, Sel)) + if (ObjCMethodDecl *OMD = PDecl->getInstanceMethod(Sel)) return OMD; for (ObjCProtocolDecl::protocol_iterator I = PDecl->protocol_begin(), @@ -2011,12 +2008,12 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy, Decl *GDecl = 0; for (ObjCObjectPointerType::qual_iterator I = QIdTy->qual_begin(), E = QIdTy->qual_end(); I != E; ++I) { - if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(Context, &Member)) { + if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member)) { GDecl = PD; break; } // Also must look for a getter name which uses property syntax. - if (ObjCMethodDecl *OMD = (*I)->getInstanceMethod(Context, Sel)) { + if (ObjCMethodDecl *OMD = (*I)->getInstanceMethod(Sel)) { GDecl = OMD; break; } @@ -2042,7 +2039,7 @@ ObjCMethodDecl *Sema::FindMethodInNestedImplementations( ObjCMethodDecl *Method = 0; if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(IFace->getIdentifier())) - Method = ImpDecl->getInstanceMethod(Context, Sel); + Method = ImpDecl->getInstanceMethod(Sel); if (!Method && IFace->getSuperClass()) return FindMethodInNestedImplementations(IFace->getSuperClass(), Sel); @@ -2201,8 +2198,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // (*Obj).ivar. if (const ObjCInterfaceType *IFTy = BaseType->getAsObjCInterfaceType()) { ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(Context, - &Member, + if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(&Member, ClassDeclared)) { // If the decl being referenced had an error, return an error for this // sub-expr without emitting another error, in order to avoid cascading @@ -2262,14 +2258,13 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, ObjCInterfaceDecl *IFace = IFTy->getDecl(); // Search for a declared property first. - if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(Context, - &Member)) { + if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(&Member)) { // Check whether we can reference this property. if (DiagnoseUseOfDecl(PD, MemberLoc)) return ExprError(); QualType ResTy = PD->getType(); Selector Sel = PP.getSelectorTable().getNullarySelector(&Member); - ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel); if (DiagnosePropertyAccessorMismatch(PD, Getter, MemberLoc)) ResTy = Getter->getResultType(); return Owned(new (Context) ObjCPropertyRefExpr(PD, ResTy, @@ -2279,8 +2274,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // Check protocols on qualified interfaces. for (ObjCInterfaceType::qual_iterator I = IFTy->qual_begin(), E = IFTy->qual_end(); I != E; ++I) - if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(Context, - &Member)) { + if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member)) { // Check whether we can reference this property. if (DiagnoseUseOfDecl(PD, MemberLoc)) return ExprError(); @@ -2296,7 +2290,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // shared with the code in ActOnInstanceMessage. Selector Sel = PP.getSelectorTable().getNullarySelector(&Member); - ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel); // If this reference is in an @implementation, check for 'private' methods. if (!Getter) @@ -2306,7 +2300,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Getter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Getter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Getter = ObjCCategoryImpls[i]->getInstanceMethod(Context, Sel); + Getter = ObjCCategoryImpls[i]->getInstanceMethod(Sel); } } if (Getter) { @@ -2319,7 +2313,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, Selector SetterSel = SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &Member); - ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -2329,7 +2323,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getInstanceMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getInstanceMethod(SetterSel); } } @@ -2390,7 +2384,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, ObjCInterfaceDecl *IFace = MD->getClassInterface(); ObjCMethodDecl *Getter; // FIXME: need to also look locally in the implementation. - if ((Getter = IFace->lookupClassMethod(Context, Sel))) { + if ((Getter = IFace->lookupClassMethod(Sel))) { // Check the use of this method. if (DiagnoseUseOfDecl(Getter, MemberLoc)) return ExprError(); @@ -2400,7 +2394,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, Selector SetterSel = SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &Member); - ObjCMethodDecl *Setter = IFace->lookupClassMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -2410,7 +2404,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getClassMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getClassMethod(SetterSel); } } @@ -2860,7 +2854,7 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) { // GCC cast to union extension RecordDecl *RD = castType->getAsRecordType()->getDecl(); RecordDecl::field_iterator Field, FieldEnd; - for (Field = RD->field_begin(Context), FieldEnd = RD->field_end(Context); + for (Field = RD->field_begin(), FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) { if (Context.getCanonicalType(Field->getType()).getUnqualifiedType() == Context.getCanonicalType(castExpr->getType()).getUnqualifiedType()) { @@ -3496,8 +3490,8 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType, Expr *&rExpr) { RecordDecl *UD = UT->getDecl(); FieldDecl *InitField = 0; // It's compatible if the expression matches any of the fields. - for (RecordDecl::field_iterator it = UD->field_begin(Context), - itend = UD->field_end(Context); + for (RecordDecl::field_iterator it = UD->field_begin(), + itend = UD->field_end(); it != itend; ++it) { if (it->getType()->isPointerType()) { // If the transparent union contains a pointer type, we allow: diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 0efd8ff775..7afa5941da 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -552,7 +552,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, bool AllowMissing, FunctionDecl *&Operator) { DeclContext::lookup_iterator Alloc, AllocEnd; - llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Context, Name); + llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name); if (Alloc == AllocEnd) { if (AllowMissing) return false; @@ -657,7 +657,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, // Check if this function is already declared. { DeclContext::lookup_iterator Alloc, AllocEnd; - for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Context, Name); + for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Name); Alloc != AllocEnd; ++Alloc) { // FIXME: Do we need to check for default arguments here? FunctionDecl *Func = cast(*Alloc); @@ -680,7 +680,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: diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index f1869f9037..7bb6b44c39 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -243,13 +243,13 @@ ObjCMethodDecl *Sema::LookupPrivateClassMethod(Selector Sel, while (ClassDecl && !Method) { if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Method = ImpDecl->getClassMethod(Context, Sel); + Method = ImpDecl->getClassMethod(Sel); // Look through local category implementations associated with the class. if (!Method) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Method; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == ClassDecl) - Method = ObjCCategoryImpls[i]->getClassMethod(Context, Sel); + Method = ObjCCategoryImpls[i]->getClassMethod(Sel); } } @@ -257,7 +257,7 @@ ObjCMethodDecl *Sema::LookupPrivateClassMethod(Selector Sel, // But only in the root. This matches gcc's behaviour and what the // runtime expects. if (!Method && !ClassDecl->getSuperClass()) { - Method = ClassDecl->lookupInstanceMethod(Context, Sel); + Method = ClassDecl->lookupInstanceMethod(Sel); // Look through local category implementations associated // with the root class. if (!Method) @@ -276,13 +276,13 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel, // If we have implementations in scope, check "private" methods. if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Method = ImpDecl->getInstanceMethod(Context, Sel); + Method = ImpDecl->getInstanceMethod(Sel); // Look through local category implementations associated with the class. if (!Method) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Method; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == ClassDecl) - Method = ObjCCategoryImpls[i]->getInstanceMethod(Context, Sel); + Method = ObjCCategoryImpls[i]->getInstanceMethod(Sel); } } ClassDecl = ClassDecl->getSuperClass(); @@ -301,7 +301,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( // Search for a declared property first. Selector Sel = PP.getSelectorTable().getNullarySelector(&propertyName); - ObjCMethodDecl *Getter = IFace->lookupClassMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupClassMethod(Sel); // If this reference is in an @implementation, check for 'private' methods. if (!Getter) @@ -309,7 +309,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Getter = ImpDecl->getClassMethod(Context, Sel); + Getter = ImpDecl->getClassMethod(Sel); if (Getter) { // FIXME: refactor/share with ActOnMemberReference(). @@ -323,7 +323,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &propertyName); - ObjCMethodDecl *Setter = IFace->lookupClassMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -331,13 +331,13 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Setter = ImpDecl->getClassMethod(Context, SetterSel); + Setter = ImpDecl->getClassMethod(SetterSel); } // Look through local category implementations associated with the class. if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getClassMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getClassMethod(SetterSel); } } @@ -450,7 +450,7 @@ Sema::ExprResult Sema::ActOnClassMessage( << Method->getDeclName(); } if (!Method) - Method = ClassDecl->lookupClassMethod(Context, Sel); + Method = ClassDecl->lookupClassMethod(Sel); // If we have an implementation in scope, check "private" methods. if (!Method) @@ -507,7 +507,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, // If we have an interface in scope, check 'super' methods. if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass()) { - Method = SuperDecl->lookupInstanceMethod(Context, Sel); + Method = SuperDecl->lookupInstanceMethod(Sel); if (!Method) // If we have implementations in scope, check "private" methods. @@ -550,7 +550,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (ObjCMethodDecl *CurMeth = getCurMethodDecl()) { if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) { // First check the public methods in the class interface. - Method = ClassDecl->lookupClassMethod(Context, Sel); + Method = ClassDecl->lookupClassMethod(Sel); if (!Method) Method = LookupPrivateClassMethod(Sel, ClassDecl); @@ -596,10 +596,10 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, for (ObjCObjectPointerType::qual_iterator I = QIdTy->qual_begin(), E = QIdTy->qual_end(); I != E; ++I) { ObjCProtocolDecl *PDecl = *I; - if (PDecl && (Method = PDecl->lookupInstanceMethod(Context, Sel))) + if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel))) break; // Since we aren't supporting "Class", look for a class method. - if (PDecl && (Method = PDecl->lookupClassMethod(Context, Sel))) + if (PDecl && (Method = PDecl->lookupClassMethod(Sel))) break; } } else if (const ObjCInterfaceType *OCIType = @@ -610,13 +610,13 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, // FIXME: consider using LookupInstanceMethodInGlobalPool, since it will be // faster than the following method (which can do *many* linear searches). // The idea is to add class info to InstanceMethodPool. - Method = ClassDecl->lookupInstanceMethod(Context, Sel); + Method = ClassDecl->lookupInstanceMethod(Sel); if (!Method) { // Search protocol qualifiers. for (ObjCQualifiedInterfaceType::qual_iterator QI = OCIType->qual_begin(), E = OCIType->qual_end(); QI != E; ++QI) { - if ((Method = (*QI)->lookupInstanceMethod(Context, Sel))) + if ((Method = (*QI)->lookupInstanceMethod(Sel))) break; } } diff --git a/lib/Sema/SemaInherit.cpp b/lib/Sema/SemaInherit.cpp index 28ca5f64ef..2f914f14a8 100644 --- a/lib/Sema/SemaInherit.cpp +++ b/lib/Sema/SemaInherit.cpp @@ -187,7 +187,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class, = (Context.getCanonicalType(BaseSpec->getType()) == Criteria.Base); break; case MemberLookupCriteria::LK_NamedMember: - Paths.ScratchPath.Decls = BaseRecord->lookup(Context, Criteria.Name); + Paths.ScratchPath.Decls = BaseRecord->lookup(Criteria.Name); while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) { if (isAcceptableLookupResult(*Paths.ScratchPath.Decls.first, Criteria.NameKind, Criteria.IDNS)) { @@ -199,7 +199,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class, break; case MemberLookupCriteria::LK_OverriddenMember: Paths.ScratchPath.Decls = - BaseRecord->lookup(Context, Criteria.Method->getDeclName()); + BaseRecord->lookup(Criteria.Method->getDeclName()); while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) { if (CXXMethodDecl *MD = dyn_cast(*Paths.ScratchPath.Decls.first)) { diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 6b812e1968..ecfdfd7ba0 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -343,8 +343,8 @@ void InitListChecker::FillInValueInitializations(InitListExpr *ILE) { if (const RecordType *RType = ILE->getType()->getAsRecordType()) { unsigned Init = 0, NumInits = ILE->getNumInits(); for (RecordDecl::field_iterator - Field = RType->getDecl()->field_begin(SemaRef.Context), - FieldEnd = RType->getDecl()->field_end(SemaRef.Context); + Field = RType->getDecl()->field_begin(), + FieldEnd = RType->getDecl()->field_end(); Field != FieldEnd; ++Field) { if (Field->isUnnamedBitfield()) continue; @@ -449,8 +449,8 @@ int InitListChecker::numStructUnionElements(QualType DeclType) { RecordDecl *structDecl = DeclType->getAsRecordType()->getDecl(); int InitializableMembers = 0; for (RecordDecl::field_iterator - Field = structDecl->field_begin(SemaRef.Context), - FieldEnd = structDecl->field_end(SemaRef.Context); + Field = structDecl->field_begin(), + FieldEnd = structDecl->field_end(); Field != FieldEnd; ++Field) { if ((*Field)->getIdentifier() || !(*Field)->isBitField()) ++InitializableMembers; @@ -580,7 +580,7 @@ void InitListChecker::CheckListElementTypes(InitListExpr *IList, } else if (DeclType->isAggregateType()) { if (DeclType->isRecordType()) { RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - CheckStructUnionTypes(IList, DeclType, RD->field_begin(SemaRef.Context), + CheckStructUnionTypes(IList, DeclType, RD->field_begin(), SubobjectIsDesignatorContext, Index, StructuredList, StructuredIndex, TopLevelObject); @@ -946,7 +946,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList, if (DeclType->isUnionType() && IList->getNumInits() == 0) { // Value-initialize the first named member of the union. RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - for (RecordDecl::field_iterator FieldEnd = RD->field_end(SemaRef.Context); + for (RecordDecl::field_iterator FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) { if (Field->getDeclName()) { StructuredList->setInitializedFieldInUnion(*Field); @@ -961,7 +961,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList, // because an error should get printed out elsewhere. It might be // worthwhile to skip over the rest of the initializer, though. RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - RecordDecl::field_iterator FieldEnd = RD->field_end(SemaRef.Context); + RecordDecl::field_iterator FieldEnd = RD->field_end(); bool InitializedSomething = false; while (Index < IList->getNumInits()) { Expr *Init = IList->getInit(Index); @@ -1090,9 +1090,9 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef, // Update FieldIter/FieldIndex; RecordDecl *Record = cast(Path.back()->getDeclContext()); - FieldIter = Record->field_begin(SemaRef.Context); + FieldIter = Record->field_begin(); FieldIndex = 0; - for (RecordDecl::field_iterator FEnd = Record->field_end(SemaRef.Context); + for (RecordDecl::field_iterator FEnd = Record->field_end(); FieldIter != FEnd; ++FieldIter) { if (FieldIter->isUnnamedBitfield()) continue; @@ -1217,8 +1217,8 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, IdentifierInfo *FieldName = D->getFieldName(); unsigned FieldIndex = 0; RecordDecl::field_iterator - Field = RT->getDecl()->field_begin(SemaRef.Context), - FieldEnd = RT->getDecl()->field_end(SemaRef.Context); + Field = RT->getDecl()->field_begin(), + FieldEnd = RT->getDecl()->field_end(); for (; Field != FieldEnd; ++Field) { if (Field->isUnnamedBitfield()) continue; @@ -1235,8 +1235,7 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, // something that we can't designate (e.g., a member function), // may find nothing, or may find a member of an anonymous // struct/union. - DeclContext::lookup_result Lookup - = RT->getDecl()->lookup(SemaRef.Context, FieldName); + DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName); if (Lookup.first == Lookup.second) { // Name lookup didn't find anything. SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown) @@ -1565,8 +1564,8 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index, if (RDecl->isUnion()) NumElements = 1; else - NumElements = std::distance(RDecl->field_begin(SemaRef.Context), - RDecl->field_end(SemaRef.Context)); + NumElements = std::distance(RDecl->field_begin(), + RDecl->field_end()); } if (NumElements < NumInits) diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index b7ab86352d..6f2fc5e0c4 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -65,7 +65,7 @@ void AddNamespaceUsingDirectives(ASTContext &Context, NamespaceSet &Visited) { DeclContext::udir_iterator I, End; - for (llvm::tie(I, End) = NS->getUsingDirectives(Context); I !=End; ++I) { + for (llvm::tie(I, End) = NS->getUsingDirectives(); I !=End; ++I) { UDirs.push_back(*I); std::push_heap(UDirs.begin(), UDirs.end(), UsingDirAncestorCompare()); NamespaceDecl *Nominated = (*I)->getNominatedNamespace(); @@ -609,7 +609,7 @@ CppNamespaceLookup(ASTContext &Context, DeclContext *NS, // Perform qualified name lookup into the LookupCtx. DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = NS->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = NS->lookup(Name); I != E; ++I) if (Sema::isAcceptableLookupResult(*I, NameKind, IDNS)) { Results.push_back(Sema::LookupResult::CreateLookupResult(Context, I, E)); break; @@ -1005,7 +1005,7 @@ Sema::LookupQualifiedName(DeclContext *LookupCtx, DeclarationName Name, // Perform qualified name lookup into the LookupCtx. DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = LookupCtx->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = LookupCtx->lookup(Name); I != E; ++I) if (isAcceptableLookupResult(*I, NameKind, IDNS)) return LookupResult::CreateLookupResult(Context, I, E); @@ -1148,7 +1148,7 @@ Sema::LookupParsedName(Scope *S, const CXXScopeSpec *SS, // (C++0x [temp.dep.type]). unsigned IDNS = getIdentifierNamespacesFromLookupNameKind(NameKind, true); DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = Current->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = Current->lookup(Name); I != E; ++I) if (isAcceptableLookupResult(*I, NameKind, IDNS)) return LookupResult::CreateLookupResult(Context, I, E); } @@ -1656,7 +1656,7 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, // namespaces even if they are not visible during an ordinary // lookup (11.4). DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = (*NS)->lookup(Context, Name); I != E; ++I) { + for (llvm::tie(I, E) = (*NS)->lookup(Name); I != E; ++I) { if (FunctionDecl *Func = dyn_cast(*I)) Functions.insert(Func); else if (FunctionTemplateDecl *FunTmpl = dyn_cast(*I)) @@ -1667,7 +1667,7 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, if (GlobalScope) { DeclContext::lookup_iterator I, E; for (llvm::tie(I, E) - = Context.getTranslationUnitDecl()->lookup(Context, Name); + = Context.getTranslationUnitDecl()->lookup(Name); I != E; ++I) { if (FunctionDecl *Func = dyn_cast(*I)) Functions.insert(Func); diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index c63f038cd9..f7deb1f26f 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1375,7 +1375,7 @@ bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType, Context.getCanonicalType(ToType).getUnqualifiedType()); DeclContext::lookup_iterator Con, ConEnd; for (llvm::tie(Con, ConEnd) - = ToRecordDecl->lookup(Context, ConstructorName); + = ToRecordDecl->lookup(ConstructorName); Con != ConEnd; ++Con) { CXXConstructorDecl *Constructor = cast(*Con); if (Constructor->isConvertingConstructor()) @@ -2516,7 +2516,7 @@ void Sema::AddMemberOperatorCandidates(OverloadedOperatorKind Op, // FIXME: Lookup in base classes, too! if (const RecordType *T1Rec = T1->getAsRecordType()) { DeclContext::lookup_const_iterator Oper, OperEnd; - for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(Context, OpName); + for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast(*Oper), Args[0], Args+1, NumArgs - 1, CandidateSet, @@ -4290,7 +4290,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, OverloadCandidateSet CandidateSet; DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Call); DeclContext::lookup_const_iterator Oper, OperEnd; - for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(Context, OpName); + for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast(*Oper), Object, Args, NumArgs, CandidateSet, /*SuppressUserConversions=*/false); @@ -4494,8 +4494,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, DeclContext::lookup_const_iterator Oper, OperEnd; for (llvm::tie(Oper, OperEnd) - = BaseRecord->getDecl()->lookup(Context, OpName); - Oper != OperEnd; ++Oper) + = BaseRecord->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast(*Oper), Base, 0, 0, CandidateSet, /*SuppressUserConversions=*/false); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index cd985c536c..e2f6d33827 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2498,7 +2498,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagKind TK, // Add the specialization into its lexical context, so that it can // be seen when iterating through the list of declarations in that // context. However, specializations are not found by name lookup. - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); return DeclPtrTy::make(Specialization); } @@ -2654,7 +2654,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, ClassTemplate, Converted, 0); Specialization->setLexicalDeclContext(CurContext); - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); return DeclPtrTy::make(Specialization); } @@ -2703,7 +2703,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, // since explicit instantiations are never found by name lookup, we // just put it into the declaration context directly. Specialization->setLexicalDeclContext(CurContext); - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); // C++ [temp.explicit]p3: // A definition of a class template or class member template diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 8af9ca1f63..ff01e41214 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -859,8 +859,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, Invalid = true; llvm::SmallVector Fields; - for (RecordDecl::decl_iterator Member = Pattern->decls_begin(Context), - MemberEnd = Pattern->decls_end(Context); + for (RecordDecl::decl_iterator Member = Pattern->decls_begin(), + MemberEnd = Pattern->decls_end(); Member != MemberEnd; ++Member) { Decl *NewMember = InstantiateDecl(*Member, Instantiation, TemplateArgs); if (NewMember) { @@ -996,8 +996,8 @@ void Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const TemplateArgumentList &TemplateArgs) { - for (DeclContext::decl_iterator D = Instantiation->decls_begin(Context), - DEnd = Instantiation->decls_end(Context); + for (DeclContext::decl_iterator D = Instantiation->decls_begin(), + DEnd = Instantiation->decls_end(); D != DEnd; ++D) { if (FunctionDecl *Function = dyn_cast(*D)) { if (!Function->getBody()) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 8cda4ec836..97a160e715 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -98,7 +98,7 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { if (Invalid) Typedef->setInvalidDecl(); - Owner->addDecl(SemaRef.Context, Typedef); + Owner->addDecl(Typedef); return Typedef; } @@ -124,7 +124,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { // are not static data members. bool Redeclaration = false; SemaRef.CheckVariableDeclaration(Var, 0, Redeclaration); - Owner->addDecl(SemaRef.Context, Var); + Owner->addDecl(Var); if (D->getInit()) { OwningExprResult Init @@ -188,7 +188,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { if (Invalid) Field->setInvalidDecl(); - Owner->addDecl(SemaRef.Context, Field); + Owner->addDecl(Field); } return Field; @@ -219,14 +219,14 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { /*PrevDecl=*/0); Enum->setInstantiationOfMemberEnum(D); Enum->setAccess(D->getAccess()); - Owner->addDecl(SemaRef.Context, Enum); + Owner->addDecl(Enum); Enum->startDefinition(); llvm::SmallVector Enumerators; EnumConstantDecl *LastEnumConst = 0; - for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(SemaRef.Context), - ECEnd = D->enumerator_end(SemaRef.Context); + for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(), + ECEnd = D->enumerator_end(); EC != ECEnd; ++EC) { // The specified value for the enumerator. OwningExprResult Value = SemaRef.Owned((Expr *)0); @@ -257,7 +257,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { } if (EnumConst) { - Enum->addDecl(SemaRef.Context, EnumConst); + Enum->addDecl(EnumConst); Enumerators.push_back(Sema::DeclPtrTy::make(EnumConst)); LastEnumConst = EnumConst; } @@ -289,7 +289,7 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { if (!D->isInjectedClassName()) Record->setInstantiationOfMemberClass(D); - Owner->addDecl(SemaRef.Context, Record); + Owner->addDecl(Record); return Record; } @@ -394,7 +394,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) { /*FIXME:*/OverloadableAttrRequired); if (!Method->isInvalidDecl() || !PrevDecl) - Owner->addDecl(SemaRef.Context, Method); + Owner->addDecl(Method); return Method; } @@ -442,7 +442,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConstructorDecl(CXXConstructorDecl *D) { /*FIXME:*/OverloadableAttrRequired); Record->addedConstructor(SemaRef.Context, Constructor); - Owner->addDecl(SemaRef.Context, Constructor); + Owner->addDecl(Constructor); return Constructor; } @@ -474,7 +474,7 @@ Decl *TemplateDeclInstantiator::VisitCXXDestructorDecl(CXXDestructorDecl *D) { NamedDecl *PrevDecl = 0; SemaRef.CheckFunctionDeclaration(Destructor, PrevDecl, Redeclaration, /*FIXME:*/OverloadableAttrRequired); - Owner->addDecl(SemaRef.Context, Destructor); + Owner->addDecl(Destructor); return Destructor; } @@ -507,7 +507,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) { NamedDecl *PrevDecl = 0; SemaRef.CheckFunctionDeclaration(Conversion, PrevDecl, Redeclaration, /*FIXME:*/OverloadableAttrRequired); - Owner->addDecl(SemaRef.Context, Conversion); + Owner->addDecl(Conversion); return Conversion; } @@ -809,8 +809,7 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) { // find the instantiation of the declaration D. NamedDecl *Result = 0; if (D->getDeclName()) { - DeclContext::lookup_result Found - = ParentDC->lookup(Context, D->getDeclName()); + DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName()); Result = findInstantiationOf(Context, D, Found.first, Found.second); } else { // Since we don't have a name for the entity we're looking for, @@ -822,8 +821,8 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) { // // FIXME: Find a better way to find these instantiations! Result = findInstantiationOf(Context, D, - ParentDC->decls_begin(Context), - ParentDC->decls_end(Context)); + ParentDC->decls_begin(), + ParentDC->decls_end()); } assert(Result && "Unable to find instantiation of declaration!"); D = Result; diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp index 65a35f92f7..e1702b52a6 100644 --- a/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -525,8 +525,7 @@ TemplateExprInstantiator::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { const IdentifierInfo &Name = SemaRef.Context.Idents.get("__builtin_shufflevector"); TranslationUnitDecl *TUDecl = SemaRef.Context.getTranslationUnitDecl(); - DeclContext::lookup_result Lookup - = TUDecl->lookup(SemaRef.Context, DeclarationName(&Name)); + DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name)); assert(Lookup.first != Lookup.second && "No __builtin_shufflevector?"); // Build a reference to the __builtin_shufflevector builtin