diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/MultiplexExternalSemaSource.cpp | 12 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 43 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 24 | ||||
-rw-r--r-- | lib/Sema/SemaLambda.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 53 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 14 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 4 |
12 files changed, 98 insertions, 97 deletions
diff --git a/lib/Sema/MultiplexExternalSemaSource.cpp b/lib/Sema/MultiplexExternalSemaSource.cpp index 8e03eb57e3..dca0a3549d 100644 --- a/lib/Sema/MultiplexExternalSemaSource.cpp +++ b/lib/Sema/MultiplexExternalSemaSource.cpp @@ -84,13 +84,13 @@ CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers( DeclContextLookupResult MultiplexExternalSemaSource:: FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) { StoredDeclsList DeclsFound; - DeclContextLookupResult lookup; for(size_t i = 0; i < Sources.size(); ++i) { - lookup = Sources[i]->FindExternalVisibleDeclsByName(DC, Name); - while(lookup.first != lookup.second) { - if (!DeclsFound.HandleRedeclaration(*lookup.first)) - DeclsFound.AddSubsequentDecl(*lookup.first); - lookup.first++; + DeclContext::lookup_result R = + Sources[i]->FindExternalVisibleDeclsByName(DC, Name); + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; + ++I) { + if (!DeclsFound.HandleRedeclaration(*I)) + DeclsFound.AddSubsequentDecl(*I); } } return DeclsFound.getLookupResult(); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 9e8f68c251..ab8cac8944 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -757,9 +757,10 @@ void ResultBuilder::MaybeAddConstructorResults(Result R) { DeclarationName ConstructorName = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(RecordTy)); - for (DeclContext::lookup_result Ctors = Record->lookup(ConstructorName); - Ctors.first != Ctors.second; ++Ctors.first) { - R.Declaration = *Ctors.first; + DeclContext::lookup_result Ctors = Record->lookup(ConstructorName); + for (DeclContext::lookup_iterator I = Ctors.begin(), E = Ctors.end(); I != E; + ++I) { + R.Declaration = *I; R.CursorKind = getCursorKindForDecl(R.Declaration); Results.push_back(R); } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 7f98c3359c..96e911d17b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4789,9 +4789,9 @@ static bool FindOverriddenMethod(const CXXBaseSpecifier *Specifier, } for (Path.Decls = BaseRecord->lookup(Name); - Path.Decls.first != Path.Decls.second; - ++Path.Decls.first) { - NamedDecl *D = *Path.Decls.first; + !Path.Decls.empty(); + Path.Decls = Path.Decls.slice(1)) { + NamedDecl *D = Path.Decls.front(); if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { if (MD->isVirtual() && !Data->S->IsOverload(Data->Method, MD, false)) return true; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 502b358315..22aad165e9 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -295,12 +295,12 @@ static bool isIntOrBool(Expr *Exp) { static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordType* RT) { DeclContextLookupConstResult Res1 = RT->getDecl()->lookup( S.Context.DeclarationNames.getCXXOperatorName(OO_Star)); - if (Res1.first == Res1.second) + if (Res1.empty()) return false; DeclContextLookupConstResult Res2 = RT->getDecl()->lookup( S.Context.DeclarationNames.getCXXOperatorName(OO_Arrow)); - if (Res2.first == Res2.second) + if (Res2.empty()) return false; return true; diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 027491cbbe..99366b6a6b 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -2119,10 +2119,10 @@ Sema::BuildMemInitializer(Decl *ConstructorD, // Look for a member, first. DeclContext::lookup_result Result = ClassDecl->lookup(MemberOrBase); - if (Result.first != Result.second) { + if (!Result.empty()) { ValueDecl *Member; - if ((Member = dyn_cast<FieldDecl>(*Result.first)) || - (Member = dyn_cast<IndirectFieldDecl>(*Result.first))) { + if ((Member = dyn_cast<FieldDecl>(Result.front())) || + (Member = dyn_cast<IndirectFieldDecl>(Result.front()))) { if (EllipsisLoc.isValid()) Diag(EllipsisLoc, diag::err_pack_expansion_member_init) << MemberOrBase @@ -3956,9 +3956,10 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { // C++ [class.mem]p14: // In addition, if class T has a user-declared constructor (12.1), every // non-static data member of class T shall have a name different from T. - for (DeclContext::lookup_result R = Record->lookup(Record->getDeclName()); - R.first != R.second; ++R.first) { - NamedDecl *D = *R.first; + DeclContext::lookup_result R = Record->lookup(Record->getDeclName()); + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; + ++I) { + NamedDecl *D = *I; if ((isa<FieldDecl>(D) && Record->hasUserDeclaredConstructor()) || isa<IndirectFieldDecl>(D)) { Diag(D->getLocation(), diag::err_member_name_of_class) @@ -5283,9 +5284,9 @@ static bool FindHiddenVirtualMethod(const CXXBaseSpecifier *Specifier, bool foundSameNameMethod = false; SmallVector<CXXMethodDecl *, 8> overloadedMethods; for (Path.Decls = BaseRecord->lookup(Name); - Path.Decls.first != Path.Decls.second; - ++Path.Decls.first) { - NamedDecl *D = *Path.Decls.first; + !Path.Decls.empty(); + Path.Decls = Path.Decls.slice(1)) { + NamedDecl *D = Path.Decls.front(); if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { MD = MD->getCanonicalDecl(); foundSameNameMethod = true; @@ -5337,10 +5338,10 @@ void Sema::DiagnoseHiddenVirtualMethods(CXXRecordDecl *DC, CXXMethodDecl *MD) { // Keep the base methods that were overriden or introduced in the subclass // by 'using' in a set. A base method not in this set is hidden. - for (DeclContext::lookup_result res = DC->lookup(MD->getDeclName()); - res.first != res.second; ++res.first) { - NamedDecl *ND = *res.first; - if (UsingShadowDecl *shad = dyn_cast<UsingShadowDecl>(*res.first)) + DeclContext::lookup_result R = DC->lookup(MD->getDeclName()); + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; ++I) { + NamedDecl *ND = *I; + if (UsingShadowDecl *shad = dyn_cast<UsingShadowDecl>(*I)) ND = shad->getTargetDecl(); if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(ND)) AddMostOverridenMethods(MD, Data.OverridenAndUsingBaseMethods); @@ -6025,11 +6026,11 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope, Decl::IDNS_Type | Decl::IDNS_Using | Decl::IDNS_Tag | Decl::IDNS_Namespace; NamedDecl *PrevDecl = 0; - for (DeclContext::lookup_result R - = CurContext->getRedeclContext()->lookup(II); - R.first != R.second; ++R.first) { - if ((*R.first)->getIdentifierNamespace() & IDNS) { - PrevDecl = *R.first; + DeclContext::lookup_result R = CurContext->getRedeclContext()->lookup(II); + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; + ++I) { + if ((*I)->getIdentifierNamespace() & IDNS) { + PrevDecl = *I; break; } } @@ -9393,8 +9394,8 @@ bool Sema::isImplicitlyDeleted(FunctionDecl *FD) { static void markLambdaCallOperatorUsed(Sema &S, CXXRecordDecl *Lambda) { CXXMethodDecl *CallOperator = cast<CXXMethodDecl>( - *Lambda->lookup( - S.Context.DeclarationNames.getCXXOperatorName(OO_Call)).first); + Lambda->lookup( + S.Context.DeclarationNames.getCXXOperatorName(OO_Call)).front()); CallOperator->setReferenced(); CallOperator->setUsed(); } @@ -9416,7 +9417,7 @@ void Sema::DefineImplicitLambdaToFunctionPointerConversion( // Return the address of the __invoke function. DeclarationName InvokeName = &Context.Idents.get("__invoke"); CXXMethodDecl *Invoke - = cast<CXXMethodDecl>(*Lambda->lookup(InvokeName).first); + = cast<CXXMethodDecl>(Lambda->lookup(InvokeName).front()); Expr *FunctionRef = BuildDeclRefExpr(Invoke, Invoke->getType(), VK_LValue, Conv->getLocation()).take(); assert(FunctionRef && "Can't refer to __invoke function?"); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index e3df0a3275..4a93b118c6 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1853,8 +1853,8 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, // Check if this function is already declared. { - DeclContext::lookup_iterator Alloc, AllocEnd; - for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Name); + DeclContext::lookup_result R = GlobalCtx->lookup(Name); + for (DeclContext::lookup_iterator Alloc = R.begin(), AllocEnd = R.end(); Alloc != AllocEnd; ++Alloc) { // Only look at non-template functions, as it is the predefined, // non-templated allocation function we are trying to declare here. @@ -3191,9 +3191,9 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, UnaryTypeTrait UTT, bool FoundConstructor = false; unsigned FoundTQs; - DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = Self.LookupConstructors(RD); - Con != ConEnd; ++Con) { + DeclContext::lookup_const_result R = Self.LookupConstructors(RD); + for (DeclContext::lookup_const_iterator Con = R.begin(), + ConEnd = R.end(); Con != ConEnd; ++Con) { // A template constructor is never a copy constructor. // FIXME: However, it may actually be selected at the actual overload // resolution point. @@ -3230,9 +3230,9 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, UnaryTypeTrait UTT, !RD->hasNonTrivialDefaultConstructor()) return true; - DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = Self.LookupConstructors(RD); - Con != ConEnd; ++Con) { + DeclContext::lookup_const_result R = Self.LookupConstructors(RD); + for (DeclContext::lookup_const_iterator Con = R.begin(), + ConEnd = R.end(); Con != ConEnd; ++Con) { // FIXME: In C++0x, a constructor template can be a default constructor. if (isa<FunctionTemplateDecl>(*Con)) continue; diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index dcfd18b122..a5a0a11ed6 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1706,7 +1706,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, // struct/union. DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName); FieldDecl *ReplacementField = 0; - if (Lookup.first == Lookup.second) { + if (Lookup.empty()) { // Name lookup didn't find anything. Determine whether this // was a typo for another field name. FieldInitializerValidatorCCC Validator(RT->getDecl()); @@ -1739,7 +1739,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, // Name lookup found something, but it wasn't a field. SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_nonfield) << FieldName; - SemaRef.Diag((*Lookup.first)->getLocation(), + SemaRef.Diag(Lookup.front()->getLocation(), diag::note_field_designator_found); ++Index; return true; @@ -2842,12 +2842,11 @@ static void TryConstructorInitialization(Sema &S, // - Otherwise, if T is a class type, constructors are considered. The // applicable constructors are enumerated, and the best one is chosen // through overload resolution. - DeclContext::lookup_iterator ConStart, ConEnd; - llvm::tie(ConStart, ConEnd) = S.LookupConstructors(DestRecordDecl); + DeclContext::lookup_result R = S.LookupConstructors(DestRecordDecl); // The container holding the constructors can under certain conditions // be changed while iterating (e.g. because of deserialization). // To be safe we copy the lookup results to a new container. - SmallVector<NamedDecl*, 16> Ctors(ConStart, ConEnd); + SmallVector<NamedDecl*, 16> Ctors(R.begin(), R.end()); OverloadingResult Result = OR_No_Viable_Function; OverloadCandidateSet::iterator Best; @@ -3153,12 +3152,11 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, // to see if there is a suitable conversion. CXXRecordDecl *T1RecordDecl = cast<CXXRecordDecl>(T1RecordType->getDecl()); - DeclContext::lookup_iterator Con, ConEnd; - llvm::tie(Con, ConEnd) = S.LookupConstructors(T1RecordDecl); + DeclContext::lookup_result R = S.LookupConstructors(T1RecordDecl); // The container holding the constructors can under certain conditions // be changed while iterating (e.g. because of deserialization). // To be safe we copy the lookup results to a new container. - SmallVector<NamedDecl*, 16> Ctors(Con, ConEnd); + SmallVector<NamedDecl*, 16> Ctors(R.begin(), R.end()); for (SmallVector<NamedDecl*, 16>::iterator CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) { NamedDecl *D = *CI; @@ -3723,12 +3721,11 @@ static void TryUserDefinedConversion(Sema &S, // Try to complete the type we're converting to. if (!S.RequireCompleteType(Kind.getLocation(), DestType, 0)) { - DeclContext::lookup_iterator ConOrig, ConEndOrig; - llvm::tie(ConOrig, ConEndOrig) = S.LookupConstructors(DestRecordDecl); + DeclContext::lookup_result R = S.LookupConstructors(DestRecordDecl); // The container holding the constructors can under certain conditions // be changed while iterating. To be safe we copy the lookup results // to a new container. - SmallVector<NamedDecl*, 8> CopyOfCon(ConOrig, ConEndOrig); + SmallVector<NamedDecl*, 8> CopyOfCon(R.begin(), R.end()); for (SmallVector<NamedDecl*, 8>::iterator Con = CopyOfCon.begin(), ConEnd = CopyOfCon.end(); Con != ConEnd; ++Con) { @@ -4351,12 +4348,11 @@ static void LookupCopyAndMoveConstructors(Sema &S, OverloadCandidateSet &CandidateSet, CXXRecordDecl *Class, Expr *CurInitExpr) { - DeclContext::lookup_iterator Con, ConEnd; - llvm::tie(Con, ConEnd) = S.LookupConstructors(Class); + DeclContext::lookup_result R = S.LookupConstructors(Class); // The container holding the constructors can under certain conditions // be changed while iterating (e.g. because of deserialization). // To be safe we copy the lookup results to a new container. - SmallVector<NamedDecl*, 16> Ctors(Con, ConEnd); + SmallVector<NamedDecl*, 16> Ctors(R.begin(), R.end()); for (SmallVector<NamedDecl*, 16>::iterator CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) { NamedDecl *D = *CI; diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index c8810905d5..8ba14d51cc 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -902,8 +902,8 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation, CXXRecordDecl *Lambda = Conv->getParent(); CXXMethodDecl *CallOperator = cast<CXXMethodDecl>( - *Lambda->lookup( - Context.DeclarationNames.getCXXOperatorName(OO_Call)).first); + Lambda->lookup( + Context.DeclarationNames.getCXXOperatorName(OO_Call)).front()); CallOperator->setReferenced(); CallOperator->setUsed(); diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 41996b3e42..b17e0062f9 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -451,9 +451,9 @@ void LookupResult::resolveKind() { void LookupResult::addDeclsFromBasePaths(const CXXBasePaths &P) { CXXBasePaths::const_paths_iterator I, E; - DeclContext::lookup_iterator DI, DE; for (I = P.begin(), E = P.end(); I != E; ++I) - for (llvm::tie(DI,DE) = I->Decls; DI != DE; ++DI) + for (DeclContext::lookup_iterator DI = I->Decls.begin(), + DE = I->Decls.end(); DI != DE; ++DI) addDecl(*DI); } @@ -647,8 +647,9 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) { DeclareImplicitMemberFunctionsWithName(S, R.getLookupName(), DC); // Perform lookup into this declaration context. - DeclContext::lookup_const_iterator I, E; - for (llvm::tie(I, E) = DC->lookup(R.getLookupName()); I != E; ++I) { + DeclContext::lookup_const_result DR = DC->lookup(R.getLookupName()); + for (DeclContext::lookup_const_iterator I = DR.begin(), E = DR.end(); I != E; + ++I) { NamedDecl *D = *I; if ((D = R.getAcceptableDecl(D))) { R.addDecl(D); @@ -1336,7 +1337,7 @@ static bool LookupAnyMember(const CXXBaseSpecifier *Specifier, DeclarationName N = DeclarationName::getFromOpaquePtr(Name); Path.Decls = BaseRecord->lookup(N); - return Path.Decls.first != Path.Decls.second; + return !Path.Decls.empty(); } /// \brief Determine whether the given set of member declarations contains only @@ -1522,13 +1523,13 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, // We found members of the given name in two subobjects of // different types. If the declaration sets aren't the same, this // this lookup is ambiguous. - if (HasOnlyStaticMembers(Path->Decls.first, Path->Decls.second)) { + if (HasOnlyStaticMembers(Path->Decls.begin(), Path->Decls.end())) { CXXBasePaths::paths_iterator FirstPath = Paths.begin(); - DeclContext::lookup_iterator FirstD = FirstPath->Decls.first; - DeclContext::lookup_iterator CurrentD = Path->Decls.first; + DeclContext::lookup_iterator FirstD = FirstPath->Decls.begin(); + DeclContext::lookup_iterator CurrentD = Path->Decls.begin(); - while (FirstD != FirstPath->Decls.second && - CurrentD != Path->Decls.second) { + while (FirstD != FirstPath->Decls.end() && + CurrentD != Path->Decls.end()) { if ((*FirstD)->getUnderlyingDecl()->getCanonicalDecl() != (*CurrentD)->getUnderlyingDecl()->getCanonicalDecl()) break; @@ -1537,8 +1538,8 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, ++CurrentD; } - if (FirstD == FirstPath->Decls.second && - CurrentD == Path->Decls.second) + if (FirstD == FirstPath->Decls.end() && + CurrentD == Path->Decls.end()) continue; } @@ -1553,7 +1554,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, // A static member, a nested type or an enumerator defined in // a base class T can unambiguously be found even if an object // has more than one base class subobject of type T. - if (HasOnlyStaticMembers(Path->Decls.first, Path->Decls.second)) + if (HasOnlyStaticMembers(Path->Decls.begin(), Path->Decls.end())) continue; // We have found a nonstatic member name in multiple, distinct @@ -1565,8 +1566,8 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, // Lookup in a base class succeeded; return these results. - DeclContext::lookup_iterator I, E; - for (llvm::tie(I,E) = Paths.front().Decls; I != E; ++I) { + DeclContext::lookup_result DR = Paths.front().Decls; + for (DeclContext::lookup_iterator I = DR.begin(), E = DR.end(); I != E; ++I) { NamedDecl *D = *I; AccessSpecifier AS = CXXRecordDecl::MergeAccess(SubobjectAccess, D->getAccess()); @@ -1647,7 +1648,7 @@ bool Sema::DiagnoseAmbiguousLookup(LookupResult &Result) { << Name << SubobjectType << getAmbiguousPathsDisplayString(*Paths) << LookupRange; - DeclContext::lookup_iterator Found = Paths->front().Decls.first; + DeclContext::lookup_iterator Found = Paths->front().Decls.begin(); while (isa<CXXMethodDecl>(*Found) && cast<CXXMethodDecl>(*Found)->isStatic()) ++Found; @@ -1666,7 +1667,7 @@ bool Sema::DiagnoseAmbiguousLookup(LookupResult &Result) { for (CXXBasePaths::paths_iterator Path = Paths->begin(), PathEnd = Paths->end(); Path != PathEnd; ++Path) { - Decl *D = *Path->Decls.first; + Decl *D = Path->Decls.front(); if (DeclsPrinted.insert(D).second) Diag(D->getLocation(), diag::note_ambiguous_member_found); } @@ -2337,12 +2338,11 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD, // resolution. Lookup is only performed directly into the class since there // will always be a (possibly implicit) declaration to shadow any others. OverloadCandidateSet OCS((SourceLocation())); - DeclContext::lookup_iterator I, E; + DeclContext::lookup_result R = RD->lookup(Name); - llvm::tie(I, E) = RD->lookup(Name); - assert((I != E) && + assert(!R.empty() && "lookup for a constructor or assignment operator was empty"); - for ( ; I != E; ++I) { + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; ++I) { Decl *Cand = *I; if (Cand->isInvalidDecl()) @@ -2682,8 +2682,9 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, bool Operator, // associated classes are visible within their respective // 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(Name); I != E; ++I) { + DeclContext::lookup_result R = (*NS)->lookup(Name); + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; + ++I) { NamedDecl *D = *I; // If the only declaration here is an ordinary friend, consider // it only if it was declared in an associated classes. @@ -2842,8 +2843,10 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, for (DeclContext::all_lookups_iterator L = Ctx->lookups_begin(), LEnd = Ctx->lookups_end(); L != LEnd; ++L) { - for (DeclContext::lookup_result R = *L; R.first != R.second; ++R.first) { - if (NamedDecl *ND = dyn_cast<NamedDecl>(*R.first)) { + DeclContext::lookup_result R = *L; + for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; + ++I) { + if (NamedDecl *ND = dyn_cast<NamedDecl>(*I)) { if ((ND = Result.getAcceptableDecl(ND))) { Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass); Visited.add(ND); diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index cfbd33c0d3..2d82750e1b 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2881,8 +2881,8 @@ IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType, UserDefinedConversionSequence &User, OverloadCandidateSet &CandidateSet, bool AllowExplicit) { - DeclContext::lookup_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = S.LookupConstructors(To); + DeclContext::lookup_result R = S.LookupConstructors(To); + for (DeclContext::lookup_iterator Con = R.begin(), ConEnd = R.end(); Con != ConEnd; ++Con) { NamedDecl *D = *Con; DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess()); @@ -3009,8 +3009,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType, ListInitializing = true; } - DeclContext::lookup_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = S.LookupConstructors(ToRecordDecl); + DeclContext::lookup_result R = S.LookupConstructors(ToRecordDecl); + for (DeclContext::lookup_iterator Con = R.begin(), ConEnd = R.end(); Con != ConEnd; ++Con) { NamedDecl *D = *Con; DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess()); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 566f6eef7f..cca7df3fc1 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -245,8 +245,8 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { TypeAliasTemplateDecl *PrevAliasTemplate = 0; if (Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); - if (Found.first != Found.second) { - PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(*Found.first); + if (!Found.empty()) { + PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(Found.front()); } } @@ -745,8 +745,8 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { if (!isFriend && Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); - if (Found.first != Found.second) { - PrevClassTemplate = dyn_cast<ClassTemplateDecl>(*Found.first); + if (!Found.empty()) { + PrevClassTemplate = dyn_cast<ClassTemplateDecl>(Found.front()); if (PrevClassTemplate) PrevDecl = PrevClassTemplate->getTemplatedDecl(); } @@ -911,11 +911,11 @@ TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl( // of the class template and return that. DeclContext::lookup_result Found = Owner->lookup(ClassTemplate->getDeclName()); - if (Found.first == Found.second) + if (Found.empty()) return 0; ClassTemplateDecl *InstClassTemplate - = dyn_cast<ClassTemplateDecl>(*Found.first); + = dyn_cast<ClassTemplateDecl>(Found.front()); if (!InstClassTemplate) return 0; @@ -3531,7 +3531,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, NamedDecl *Result = 0; if (D->getDeclName()) { DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName()); - Result = findInstantiationOf(Context, D, Found.first, Found.second); + Result = findInstantiationOf(Context, D, Found.begin(), Found.end()); } else { // Since we don't have a name for the entity we're looking for, // our only option is to walk through all of the declarations to diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 764a7066e5..8d66acbaf2 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2416,10 +2416,10 @@ public: = SemaRef.Context.Idents.get("__builtin_shufflevector"); TranslationUnitDecl *TUDecl = SemaRef.Context.getTranslationUnitDecl(); DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name)); - assert(Lookup.first != Lookup.second && "No __builtin_shufflevector?"); + assert(!Lookup.empty() && "No __builtin_shufflevector?"); // Build a reference to the __builtin_shufflevector builtin - FunctionDecl *Builtin = cast<FunctionDecl>(*Lookup.first); + FunctionDecl *Builtin = cast<FunctionDecl>(Lookup.front()); Expr *Callee = new (SemaRef.Context) DeclRefExpr(Builtin, false, SemaRef.Context.BuiltinFnTy, VK_RValue, BuiltinLoc); |