From f8fdd744441d83f7d65108f348a3311564dd4d88 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 19 Nov 2014 07:49:47 +0000 Subject: [PATCH] Update for LLVM API change to make Small(Ptr)Set::insert return pair as per the C++ standard's associative container concept. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222335 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/Overload.h | 4 +- lib/AST/DeclCXX.cpp | 4 +- lib/AST/RecordLayoutBuilder.cpp | 2 +- lib/AST/VTTBuilder.cpp | 4 +- lib/AST/VTableBuilder.cpp | 17 ++--- lib/Analysis/AnalysisDeclContext.cpp | 2 +- lib/CodeGen/CGCall.cpp | 6 +- lib/CodeGen/CGClass.cpp | 2 +- lib/CodeGen/CGCleanup.cpp | 5 +- lib/CodeGen/CGCleanup.h | 4 +- lib/CodeGen/CGException.cpp | 2 +- lib/CodeGen/CGObjCMac.cpp | 2 +- lib/CodeGen/CodeGenModule.cpp | 12 ++-- lib/CodeGen/CodeGenTypes.cpp | 10 +-- lib/CodeGen/ItaniumCXXABI.cpp | 4 +- lib/CodeGen/MicrosoftCXXABI.cpp | 6 +- lib/Frontend/InitHeaderSearch.cpp | 6 +- lib/Frontend/Rewrite/RewriteModernObjC.cpp | 4 +- lib/Frontend/Rewrite/RewriteObjC.cpp | 4 +- lib/Parse/ParseDecl.cpp | 2 +- lib/Sema/AnalysisBasedWarnings.cpp | 4 +- lib/Sema/Sema.cpp | 2 +- lib/Sema/SemaCodeComplete.cpp | 76 ++++++++++++---------- lib/Sema/SemaDeclCXX.cpp | 8 +-- lib/Sema/SemaDeclObjC.cpp | 4 +- lib/Sema/SemaExprCXX.cpp | 2 +- lib/Sema/SemaLambda.cpp | 2 +- lib/Sema/SemaLookup.cpp | 20 +++--- lib/Sema/SemaObjCProperty.cpp | 2 +- lib/Sema/SemaOverload.cpp | 26 ++++---- lib/Sema/SemaTemplate.cpp | 2 +- lib/Sema/SemaTemplateDeduction.cpp | 2 +- lib/Sema/SemaTemplateVariadic.cpp | 2 +- lib/Serialization/ASTReader.cpp | 4 +- lib/Serialization/ASTReaderDecl.cpp | 2 +- lib/Serialization/ASTWriter.cpp | 2 +- lib/StaticAnalyzer/Core/RegionStore.cpp | 2 +- 37 files changed, 139 insertions(+), 125 deletions(-) diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h index dd5f7677ba..41dcf974e5 100644 --- a/include/clang/Sema/Overload.h +++ b/include/clang/Sema/Overload.h @@ -722,8 +722,8 @@ namespace clang { /// \brief Determine when this overload candidate will be new to the /// overload set. - bool isNewCandidate(Decl *F) { - return Functions.insert(F->getCanonicalDecl()); + bool isNewCandidate(Decl *F) { + return Functions.insert(F->getCanonicalDecl()).second; } /// \brief Clear out all of the candidates. diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 623cae5bf7..0ee3e3e904 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -209,7 +209,7 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, // Now go through all virtual bases of this base and add them. for (const auto &VBase : BaseClassDecl->vbases()) { // Add this base if it's not already in the list. - if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType()))) { + if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType())).second) { VBases.push_back(&VBase); // C++11 [class.copy]p8: @@ -225,7 +225,7 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, if (Base->isVirtual()) { // Add this base if it's not already in the list. - if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType))) + if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second) VBases.push_back(Base); // C++0x [meta.unary.prop] is_empty: diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index 72ccebd85c..0d070a4bfb 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -1093,7 +1093,7 @@ RecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *RD, // Only lay out the virtual base if it's not an indirect primary base. if (!IndirectPrimaryBase) { // Only visit virtual bases once. - if (!VisitedVirtualBases.insert(BaseDecl)) + if (!VisitedVirtualBases.insert(BaseDecl).second) continue; const BaseSubobjectInfo *BaseInfo = VirtualBaseInfo.lookup(BaseDecl); diff --git a/lib/AST/VTTBuilder.cpp b/lib/AST/VTTBuilder.cpp index c213d1cef6..53461ebbb8 100644 --- a/lib/AST/VTTBuilder.cpp +++ b/lib/AST/VTTBuilder.cpp @@ -105,7 +105,7 @@ VTTBuilder::LayoutSecondaryVirtualPointers(BaseSubobject Base, CharUnits BaseOffset; if (I.isVirtual()) { // Ignore virtual bases that we've already visited. - if (!VBases.insert(BaseDecl)) + if (!VBases.insert(BaseDecl).second) continue; BaseOffset = MostDerivedClassLayout.getVBaseClassOffset(BaseDecl); @@ -157,7 +157,7 @@ void VTTBuilder::LayoutVirtualVTTs(const CXXRecordDecl *RD, // Check if this is a virtual base. if (I.isVirtual()) { // Check if we've seen this base before. - if (!VBases.insert(BaseDecl)) + if (!VBases.insert(BaseDecl).second) continue; CharUnits BaseOffset = diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp index a05e0da69c..d8723b3aee 100644 --- a/lib/AST/VTableBuilder.cpp +++ b/lib/AST/VTableBuilder.cpp @@ -389,7 +389,7 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base, CharUnits BaseOffset; if (B.isVirtual()) { - if (!VisitedVirtualBases.insert(BaseDecl)) { + if (!VisitedVirtualBases.insert(BaseDecl).second) { // We've visited this base before. continue; } @@ -748,7 +748,7 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffsets(const CXXRecordDecl *RD, const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl(); // Check if this is a virtual base that we haven't visited before. - if (B.isVirtual() && VisitedVirtualBases.insert(BaseDecl)) { + if (B.isVirtual() && VisitedVirtualBases.insert(BaseDecl).second) { CharUnits Offset = LayoutClassLayout.getVBaseClassOffset(BaseDecl) - OffsetInLayoutClass; @@ -1105,7 +1105,7 @@ namespace { bool visit(const CXXMethodDecl *MD) { // Don't recurse on this method if we've already collected it. - return Methods->insert(MD); + return Methods->insert(MD).second; } }; } @@ -1842,7 +1842,7 @@ void ItaniumVTableBuilder::DeterminePrimaryVirtualBases( CharUnits BaseOffsetInLayoutClass; if (B.isVirtual()) { - if (!VBases.insert(BaseDecl)) + if (!VBases.insert(BaseDecl).second) continue; const ASTRecordLayout &LayoutClassLayout = @@ -1870,8 +1870,9 @@ void ItaniumVTableBuilder::LayoutVTablesForVirtualBases( // Check if this base needs a vtable. (If it's virtual, not a primary base // of some other class, and we haven't visited it before). - if (B.isVirtual() && BaseDecl->isDynamicClass() && - !PrimaryVirtualBases.count(BaseDecl) && VBases.insert(BaseDecl)) { + if (B.isVirtual() && BaseDecl->isDynamicClass() && + !PrimaryVirtualBases.count(BaseDecl) && + VBases.insert(BaseDecl).second) { const ASTRecordLayout &MostDerivedClassLayout = Context.getASTRecordLayout(MostDerivedClass); CharUnits BaseOffset = @@ -2636,7 +2637,7 @@ struct InitialOverriddenDefinitionCollector { if (OverriddenMD->size_overridden_methods() == 0) Bases.insert(OverriddenMD->getParent()); // Don't recurse on this method if we've already collected it. - return VisitedOverriddenMethods.insert(OverriddenMD); + return VisitedOverriddenMethods.insert(OverriddenMD).second; } }; @@ -3459,7 +3460,7 @@ findPathForVPtr(ASTContext &Context, const ASTRecordLayout &MostDerivedLayout, if (!B.isVirtual()) NewOffset = Offset + Layout.getBaseClassOffset(Base); else { - if (!VBasesSeen.insert(Base)) + if (!VBasesSeen.insert(Base).second) return false; NewOffset = MostDerivedLayout.getVBaseClassOffset(Base); } diff --git a/lib/Analysis/AnalysisDeclContext.cpp b/lib/Analysis/AnalysisDeclContext.cpp index dd154f457a..be66f32e77 100644 --- a/lib/Analysis/AnalysisDeclContext.cpp +++ b/lib/Analysis/AnalysisDeclContext.cpp @@ -481,7 +481,7 @@ public: // Non-local variables are also directly modified. if (const VarDecl *VD = dyn_cast(DR->getDecl())) { if (!VD->hasLocalStorage()) { - if (Visited.insert(VD)) + if (Visited.insert(VD).second) BEVals.push_back(VD, BC); } } diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 06d02b52c8..2ced44d965 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -469,7 +469,8 @@ CodeGenTypes::arrangeLLVMFunctionInfo(CanQualType resultType, required); FunctionInfos.InsertNode(FI, insertPos); - bool inserted = FunctionsBeingProcessed.insert(FI); (void)inserted; + bool inserted = FunctionsBeingProcessed.insert(FI).second; + (void)inserted; assert(inserted && "Recursively being processed?"); // Compute ABI information. @@ -1202,7 +1203,8 @@ llvm::FunctionType *CodeGenTypes::GetFunctionType(GlobalDecl GD) { llvm::FunctionType * CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) { - bool Inserted = FunctionsBeingProcessed.insert(&FI); (void)Inserted; + bool Inserted = FunctionsBeingProcessed.insert(&FI).second; + (void)Inserted; assert(Inserted && "Recursively being processed?"); llvm::Type *resultType = nullptr; diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index f64b8fef3f..8138c6fc8d 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -2022,7 +2022,7 @@ CodeGenFunction::InitializeVTablePointers(BaseSubobject Base, if (I.isVirtual()) { // Check if we've visited this virtual base before. - if (!VBases.insert(BaseDecl)) + if (!VBases.insert(BaseDecl).second) continue; const ASTRecordLayout &Layout = diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 4482f1c1d6..d81e3a597b 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -301,7 +301,8 @@ static void ResolveAllBranchFixups(CodeGenFunction &CGF, } // Don't add this case to the switch statement twice. - if (!CasesAdded.insert(Fixup.Destination)) continue; + if (!CasesAdded.insert(Fixup.Destination).second) + continue; Switch->addCase(CGF.Builder.getInt32(Fixup.DestinationIndex), Fixup.Destination); @@ -357,7 +358,7 @@ void CodeGenFunction::ResolveBranchFixups(llvm::BasicBlock *Block) { continue; // Don't process the same optimistic branch block twice. - if (!ModifiedOptimisticBlocks.insert(BranchBB)) + if (!ModifiedOptimisticBlocks.insert(BranchBB).second) continue; llvm::SwitchInst *Switch = TransitionToCleanupSwitch(*this, BranchBB); diff --git a/lib/CodeGen/CGCleanup.h b/lib/CodeGen/CGCleanup.h index cbc51c33cd..dd156c696a 100644 --- a/lib/CodeGen/CGCleanup.h +++ b/lib/CodeGen/CGCleanup.h @@ -343,7 +343,7 @@ public: void addBranchAfter(llvm::ConstantInt *Index, llvm::BasicBlock *Block) { struct ExtInfo &ExtInfo = getExtInfo(); - if (ExtInfo.Branches.insert(Block)) + if (ExtInfo.Branches.insert(Block).second) ExtInfo.BranchAfters.push_back(std::make_pair(Block, Index)); } @@ -378,7 +378,7 @@ public: /// /// \return true if the branch-through was new to this scope bool addBranchThrough(llvm::BasicBlock *Block) { - return getExtInfo().Branches.insert(Block); + return getExtInfo().Branches.insert(Block).second; } /// Determines if this cleanup scope has any branch throughs. diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index b147b436bf..8cd49d1703 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -817,7 +817,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { } // Check whether we already have a handler for this type. - if (catchTypes.insert(handler.Type)) + if (catchTypes.insert(handler.Type).second) // If not, add it directly to the landingpad. LPadInst->addClause(handler.Type); } diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index de56e16628..c05c2263f4 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -2758,7 +2758,7 @@ PushProtocolProperties(llvm::SmallPtrSet &PropertySet, for (const auto *P : Proto->protocols()) PushProtocolProperties(PropertySet, Properties, Container, P, ObjCTypes); for (const auto *PD : Proto->properties()) { - if (!PropertySet.insert(PD->getIdentifier())) + if (!PropertySet.insert(PD->getIdentifier()).second) continue; llvm::Constant *Prop[] = { GetPropertyName(PD->getIdentifier()), diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index a6f2d6cfe5..b35e81c0b2 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -245,7 +245,7 @@ static const llvm::GlobalObject *getAliasedGlobal(const llvm::GlobalAlias &GA) { auto *GA2 = dyn_cast(C); if (!GA2) return nullptr; - if (!Visited.insert(GA2)) + if (!Visited.insert(GA2).second) return nullptr; C = GA2->getAliasee(); } @@ -974,13 +974,13 @@ static void addLinkOptionsPostorder(CodeGenModule &CGM, SmallVectorImpl &Metadata, llvm::SmallPtrSet &Visited) { // Import this module's parent. - if (Mod->Parent && Visited.insert(Mod->Parent)) { + if (Mod->Parent && Visited.insert(Mod->Parent).second) { addLinkOptionsPostorder(CGM, Mod->Parent, Metadata, Visited); } // Import this module's dependencies. for (unsigned I = Mod->Imports.size(); I > 0; --I) { - if (Visited.insert(Mod->Imports[I-1])) + if (Visited.insert(Mod->Imports[I - 1]).second) addLinkOptionsPostorder(CGM, Mod->Imports[I-1], Metadata, Visited); } @@ -1021,7 +1021,7 @@ void CodeGenModule::EmitModuleLinkOptions() { for (llvm::SetVector::iterator M = ImportedModules.begin(), MEnd = ImportedModules.end(); M != MEnd; ++M) { - if (Visited.insert(*M)) + if (Visited.insert(*M).second) Stack.push_back(*M); } @@ -1041,7 +1041,7 @@ void CodeGenModule::EmitModuleLinkOptions() { if ((*Sub)->IsExplicit) continue; - if (Visited.insert(*Sub)) { + if (Visited.insert(*Sub).second) { Stack.push_back(*Sub); AnyChildren = true; } @@ -1062,7 +1062,7 @@ void CodeGenModule::EmitModuleLinkOptions() { for (llvm::SetVector::iterator M = LinkModules.begin(), MEnd = LinkModules.end(); M != MEnd; ++M) { - if (Visited.insert(*M)) + if (Visited.insert(*M).second) addLinkOptionsPostorder(*this, *M, MetadataArgs, Visited); } std::reverse(MetadataArgs.begin(), MetadataArgs.end()); diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 1404dfd7a9..44494ae989 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -115,8 +115,9 @@ isSafeToConvert(const RecordDecl *RD, CodeGenTypes &CGT, llvm::SmallPtrSet &AlreadyChecked) { // If we have already checked this type (maybe the same type is used by-value // multiple times in multiple structure fields, don't check again. - if (!AlreadyChecked.insert(RD)) return true; - + if (!AlreadyChecked.insert(RD).second) + return true; + const Type *Key = CGT.getContext().getTagDeclType(RD).getTypePtr(); // If this type is already laid out, converting it is a noop. @@ -500,7 +501,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { // While we're converting the parameter types for a function, we don't want // to recursively convert any pointed-to structs. Converting directly-used // structs is ok though. - if (!RecordsBeingLaidOut.insert(Ty)) { + if (!RecordsBeingLaidOut.insert(Ty).second) { ResultType = llvm::StructType::get(getLLVMContext()); SkippedLayout = true; @@ -656,7 +657,8 @@ llvm::StructType *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) { } // Okay, this is a definition of a type. Compile the implementation now. - bool InsertResult = RecordsBeingLaidOut.insert(Key); (void)InsertResult; + bool InsertResult = RecordsBeingLaidOut.insert(Key).second; + (void)InsertResult; assert(InsertResult && "Recursively compiling a struct?"); // Force conversion of non-virtual base classes recursively. diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 0e5aba8ef2..a65c5ef8fc 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -2816,7 +2816,7 @@ static unsigned ComputeVMIClassTypeInfoFlags(const CXXBaseSpecifier *Base, if (Base->isVirtual()) { // Mark the virtual base as seen. - if (!Bases.VirtualBases.insert(BaseDecl)) { + if (!Bases.VirtualBases.insert(BaseDecl).second) { // If this virtual base has been seen before, then the class is diamond // shaped. Flags |= ItaniumRTTIBuilder::VMI_DiamondShaped; @@ -2826,7 +2826,7 @@ static unsigned ComputeVMIClassTypeInfoFlags(const CXXBaseSpecifier *Base, } } else { // Mark the non-virtual base as seen. - if (!Bases.NonVirtualBases.insert(BaseDecl)) { + if (!Bases.NonVirtualBases.insert(BaseDecl).second) { // If this non-virtual base has been seen before, then the class has non- // diamond shaped repeated inheritance. Flags |= ItaniumRTTIBuilder::VMI_NonDiamondRepeat; diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index a9d35c32cb..659ed0a305 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1292,7 +1292,7 @@ llvm::GlobalVariable *MicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, MicrosoftVTableContext &VTContext = CGM.getMicrosoftVTableContext(); const VPtrInfoVector &VFPtrs = VTContext.getVFPtrOffsets(RD); - if (DeferredVFTables.insert(RD)) { + if (DeferredVFTables.insert(RD).second) { // We haven't processed this record type before. // Queue up this v-table for possible deferred emission. CGM.addDeferredVTable(RD); @@ -2784,11 +2784,11 @@ detectAmbiguousBases(SmallVectorImpl &Classes) { llvm::SmallPtrSet AmbiguousBases; for (MSRTTIClass *Class = &Classes.front(); Class <= &Classes.back();) { if ((Class->Flags & MSRTTIClass::IsVirtual) && - !VirtualBases.insert(Class->RD)) { + !VirtualBases.insert(Class->RD).second) { Class = MSRTTIClass::getNextChild(Class); continue; } - if (!UniqueBases.insert(Class->RD)) + if (!UniqueBases.insert(Class->RD).second) AmbiguousBases.insert(Class->RD); Class++; } diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp index 998ccf9e91..5e89c8c4d3 100644 --- a/lib/Frontend/InitHeaderSearch.cpp +++ b/lib/Frontend/InitHeaderSearch.cpp @@ -529,16 +529,16 @@ static unsigned RemoveDuplicates(std::vector &SearchList, if (CurEntry.isNormalDir()) { // If this isn't the first time we've seen this dir, remove it. - if (SeenDirs.insert(CurEntry.getDir())) + if (SeenDirs.insert(CurEntry.getDir()).second) continue; } else if (CurEntry.isFramework()) { // If this isn't the first time we've seen this framework dir, remove it. - if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir())) + if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir()).second) continue; } else { assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?"); // If this isn't the first time we've seen this headermap, remove it. - if (SeenHeaderMaps.insert(CurEntry.getHeaderMap())) + if (SeenHeaderMaps.insert(CurEntry.getHeaderMap()).second) continue; } diff --git a/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/lib/Frontend/Rewrite/RewriteModernObjC.cpp index bcfba22668..ffac51ed5f 100644 --- a/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -4041,7 +4041,7 @@ void RewriteModernObjC::RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl, endBuf += Lexer::MeasureTokenLength(LocEnd, *SM, LangOpts); ReplaceText(LocStart, endBuf-startBuf, Result); // Mark this struct as having been generated. - if (!ObjCSynthesizedStructs.insert(CDecl)) + if (!ObjCSynthesizedStructs.insert(CDecl).second) llvm_unreachable("struct already synthesize- RewriteObjCInternalStruct"); } @@ -7105,7 +7105,7 @@ void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, Result += ";\n"; // Mark this protocol as having been generated. - if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl())) + if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl()).second) llvm_unreachable("protocol already synthesized"); } diff --git a/lib/Frontend/Rewrite/RewriteObjC.cpp b/lib/Frontend/Rewrite/RewriteObjC.cpp index 3350815343..5fb237449a 100644 --- a/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -3227,7 +3227,7 @@ void RewriteObjC::RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl, ReplaceText(LocStart, endBuf-startBuf, Result); } // Mark this struct as having been generated. - if (!ObjCSynthesizedStructs.insert(CDecl)) + if (!ObjCSynthesizedStructs.insert(CDecl).second) llvm_unreachable("struct already synthesize- SynthesizeObjCInternalStruct"); } @@ -5260,7 +5260,7 @@ void RewriteObjCFragileABI::RewriteObjCProtocolMetaData( Result += "};\n"; // Mark this protocol as having been generated. - if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl())) + if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl()).second) llvm_unreachable("protocol already synthesized"); } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2e30c52df9..9266644c59 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -5400,7 +5400,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList( Diag(Tok, diag::err_unexpected_typedef_ident) << ParmII; // Verify that the argument identifier has not already been mentioned. - if (!ParamsSoFar.insert(ParmII)) { + if (!ParamsSoFar.insert(ParmII).second) { Diag(Tok, diag::err_param_redefinition) << ParmII; } else { // Remember this identifier in ParamInfo. diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 4d3d3e3c37..f666a9b463 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -916,7 +916,7 @@ namespace { // issue a warn_fallthrough_attr_unreachable for them. for (const auto *B : *Cfg) { const Stmt *L = B->getLabel(); - if (L && isa(L) && ReachableBlocks.insert(B)) + if (L && isa(L) && ReachableBlocks.insert(B).second) BlockQueue.push_back(B); } @@ -926,7 +926,7 @@ namespace { for (CFGBlock::const_succ_iterator I = P->succ_begin(), E = P->succ_end(); I != E; ++I) { - if (*I && ReachableBlocks.insert(*I)) + if (*I && ReachableBlocks.insert(*I).second) BlockQueue.push_back(*I); } } diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 63d7357505..66a0443250 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -769,7 +769,7 @@ void Sema::ActOnEndOfTranslationUnit() { // If the tentative definition was completed, getActingDefinition() returns // null. If we've already seen this variable before, insert()'s second // return value is false. - if (!VD || VD->isInvalidDecl() || !Seen.insert(VD)) + if (!VD || VD->isInvalidDecl() || !Seen.insert(VD).second) continue; if (const IncompleteArrayType *ArrayT diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 8b87254b0e..50d51348f4 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -894,7 +894,7 @@ void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) { } // Make sure that any given declaration only shows up in the result set once. - if (!AllDeclsFound.insert(CanonDecl)) + if (!AllDeclsFound.insert(CanonDecl).second) return; // If the filter is for nested-name-specifiers, then this result starts a @@ -957,7 +957,7 @@ void ResultBuilder::AddResult(Result R, DeclContext *CurContext, return; // Make sure that any given declaration only shows up in the result set once. - if (!AllDeclsFound.insert(R.Declaration->getCanonicalDecl())) + if (!AllDeclsFound.insert(R.Declaration->getCanonicalDecl()).second) return; // If the filter is for nested-name-specifiers, then this result starts a @@ -3467,7 +3467,7 @@ static void AddObjCProperties(ObjCContainerDecl *Container, // Add properties in this container. for (const auto *P : Container->properties()) - if (AddedProperties.insert(P->getIdentifier())) + if (AddedProperties.insert(P->getIdentifier()).second) Results.MaybeAddResult(Result(P, Results.getBasePriority(P), nullptr), CurContext); @@ -3478,7 +3478,7 @@ static void AddObjCProperties(ObjCContainerDecl *Container, for (auto *M : Container->methods()) { if (M->getSelector().isUnarySelector()) if (IdentifierInfo *Name = M->getSelector().getIdentifierInfoForSlot(0)) - if (AddedProperties.insert(Name)) { + if (AddedProperties.insert(Name).second) { CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); AddResultTypeChunk(Context, Policy, M, Builder); @@ -4236,7 +4236,8 @@ void Sema::CodeCompleteConstructorInitializer( bool SawLastInitializer = Initializers.empty(); CXXRecordDecl *ClassDecl = Constructor->getParent(); for (const auto &Base : ClassDecl->bases()) { - if (!InitializedBases.insert(Context.getCanonicalType(Base.getType()))) { + if (!InitializedBases.insert(Context.getCanonicalType(Base.getType())) + .second) { SawLastInitializer = !Initializers.empty() && Initializers.back()->isBaseInitializer() && @@ -4259,7 +4260,8 @@ void Sema::CodeCompleteConstructorInitializer( // Add completions for virtual base classes. for (const auto &Base : ClassDecl->vbases()) { - if (!InitializedBases.insert(Context.getCanonicalType(Base.getType()))) { + if (!InitializedBases.insert(Context.getCanonicalType(Base.getType())) + .second) { SawLastInitializer = !Initializers.empty() && Initializers.back()->isBaseInitializer() && @@ -4282,7 +4284,8 @@ void Sema::CodeCompleteConstructorInitializer( // Add completions for members. for (auto *Field : ClassDecl->fields()) { - if (!InitializedFields.insert(cast(Field->getCanonicalDecl()))) { + if (!InitializedFields.insert(cast(Field->getCanonicalDecl())) + .second) { SawLastInitializer = !Initializers.empty() && Initializers.back()->isAnyMemberInitializer() && @@ -4349,7 +4352,7 @@ void Sema::CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, Var->hasAttr()) continue; - if (Known.insert(Var->getIdentifier())) + if (Known.insert(Var->getIdentifier()).second) Results.AddResult(CodeCompletionResult(Var, CCP_LocalDeclaration), CurContext, nullptr, false); } @@ -4818,7 +4821,7 @@ static void AddObjCMethods(ObjCContainerDecl *Container, if (!isAcceptableObjCMethod(M, WantKind, SelIdents, AllowSameLength)) continue; - if (!Selectors.insert(M->getSelector())) + if (!Selectors.insert(M->getSelector()).second) continue; Result R = Result(M, Results.getBasePriority(M), nullptr); @@ -5579,7 +5582,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents)) continue; - if (!Selectors.insert(MethList->Method->getSelector())) + if (!Selectors.insert(MethList->Method->getSelector()).second) continue; Result R(MethList->Method, Results.getBasePriority(MethList->Method), @@ -5859,7 +5862,7 @@ void Sema::CodeCompleteObjCInterfaceCategory(Scope *S, TranslationUnitDecl *TU = Context.getTranslationUnitDecl(); for (const auto *D : TU->decls()) if (const auto *Category = dyn_cast(D)) - if (CategoryNames.insert(Category->getIdentifier())) + if (CategoryNames.insert(Category->getIdentifier()).second) Results.AddResult(Result(Category, Results.getBasePriority(Category), nullptr), CurContext, nullptr, false); @@ -5897,7 +5900,7 @@ void Sema::CodeCompleteObjCImplementationCategory(Scope *S, while (Class) { for (const auto *Cat : Class->visible_categories()) { if ((!IgnoreImplemented || !Cat->getImplementation()) && - CategoryNames.insert(Cat->getIdentifier())) + CategoryNames.insert(Cat->getIdentifier()).second) Results.AddResult(Result(Cat, Results.getBasePriority(Cat), nullptr), CurContext, nullptr, false); } @@ -6218,7 +6221,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, // Add the normal accessor -(type)key. if (IsInstanceMethod && - KnownSelectors.insert(Selectors.getNullarySelector(PropName)) && + KnownSelectors.insert(Selectors.getNullarySelector(PropName)).second && ReturnTypeMatchesProperty && !Property->getGetterMethodDecl()) { if (ReturnType.isNull()) AddObjCPassingTypeChunk(Property->getType(), /*Quals=*/0, @@ -6239,7 +6242,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, Property->getType()->isBooleanType())))) { std::string SelectorName = (Twine("is") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId)) + .second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("BOOL"); @@ -6258,7 +6262,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, !Property->getSetterMethodDecl()) { std::string SelectorName = (Twine("set") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6310,7 +6314,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, (ReturnType.isNull() || ReturnType->isIntegerType())) { std::string SelectorName = (Twine("countOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId)) + .second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("NSUInteger"); @@ -6333,7 +6338,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("objectIn") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("id"); @@ -6360,7 +6365,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine(Property->getName()) + "AtIndexes").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("NSArray *"); @@ -6385,7 +6390,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, &Context.Idents.get("range") }; - if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds))) { + if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6419,7 +6424,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, &Context.Idents.get(SelectorName) }; - if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds))) { + if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6451,7 +6456,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, &Context.Idents.get("atIndexes") }; - if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds))) { + if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6479,7 +6484,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("removeObjectFrom") + UpperKey + "AtIndex").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6501,7 +6506,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("remove") + UpperKey + "AtIndexes").str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6527,7 +6532,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, &Context.Idents.get("withObject") }; - if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds))) { + if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6560,7 +6565,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, &Context.Idents.get(SelectorName2) }; - if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds))) { + if (KnownSelectors.insert(Selectors.getSelector(2, SelectorIds)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6593,7 +6598,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, ->getName() == "NSEnumerator"))) { std::string SelectorName = (Twine("enumeratorOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId)) + .second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("NSEnumerator *"); @@ -6611,7 +6617,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, (ReturnType.isNull() || ReturnType->isObjCObjectPointerType())) { std::string SelectorName = (Twine("memberOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddPlaceholderChunk("object-type"); @@ -6642,7 +6648,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("add") + UpperKey + Twine("Object")).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6664,7 +6670,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName = (Twine("add") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6686,7 +6692,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("remove") + UpperKey + Twine("Object")).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6708,7 +6714,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName = (Twine("remove") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6729,7 +6735,7 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, if (IsInstanceMethod && ReturnTypeMatchesVoid) { std::string SelectorName = (Twine("intersect") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getUnarySelector(SelectorId)).second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("void"); @@ -6757,7 +6763,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("keyPathsForValuesAffecting") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId)) + .second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("NSSet *"); @@ -6778,7 +6785,8 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, std::string SelectorName = (Twine("automaticallyNotifiesObserversOf") + UpperKey).str(); IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName); - if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) { + if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId)) + .second) { if (ReturnType.isNull()) { Builder.AddChunk(CodeCompletionString::CK_LeftParen); Builder.AddTextChunk("BOOL"); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 6e9e7a8375..f23d1a02b1 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -213,7 +213,7 @@ Sema::ImplicitExceptionSpecification::CalledDecl(SourceLocation CallLoc, ComputedEST = EST_Dynamic; // Record the exceptions in this function's exception specification. for (const auto &E : Proto->exceptions()) - if (ExceptionsSeen.insert(Self->Context.getCanonicalType(E))) + if (ExceptionsSeen.insert(Self->Context.getCanonicalType(E)).second) Exceptions.push_back(E); } @@ -4439,7 +4439,7 @@ void Sema::DiagnoseAbstractType(const CXXRecordDecl *RD) { if (!SO->second.front().Method->isPure()) continue; - if (!SeenPureMethods.insert(SO->second.front().Method)) + if (!SeenPureMethods.insert(SO->second.front().Method).second) continue; Diag(SO->second.front().Method->getLocation(), @@ -8668,7 +8668,7 @@ struct DeclaringSpecialMember { DeclaringSpecialMember(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM) : S(S), D(RD, CSM) { - WasAlreadyBeingDeclared = !S.SpecialMembersBeingDeclared.insert(D); + WasAlreadyBeingDeclared = !S.SpecialMembersBeingDeclared.insert(D).second; if (WasAlreadyBeingDeclared) // This almost never happens, but if it does, ensure that our cache // doesn't contain a stale result. @@ -13174,7 +13174,7 @@ void DelegatingCycleHelper(CXXConstructorDecl* Ctor, // Avoid dereferencing a null pointer here. *TCanonical = Target? Target->getCanonicalDecl() : nullptr; - if (!Current.insert(Canonical)) + if (!Current.insert(Canonical).second) return; // We know that beyond here, we aren't chaining into a cycle. diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 96106440c9..eccf2e1d2a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1815,7 +1815,7 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap, // Check and see if instance methods in class interface have been // implemented in the implementation class. If so, their types match. for (auto *I : CDecl->instance_methods()) { - if (!InsMapSeen.insert(I->getSelector())) + if (!InsMapSeen.insert(I->getSelector()).second) continue; if (!I->isPropertyAccessor() && !InsMap.count(I->getSelector())) { @@ -1842,7 +1842,7 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap, // Check and see if class methods in class interface have been // implemented in the implementation class. If so, their types match. for (auto *I : CDecl->class_methods()) { - if (!ClsMapSeen.insert(I->getSelector())) + if (!ClsMapSeen.insert(I->getSelector()).second) continue; if (!ClsMap.count(I->getSelector())) { if (ImmediateClass) diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 4733b0b54b..02a657fd25 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -5246,7 +5246,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, OperatorArrows.push_back(OpCall->getDirectCallee()); BaseType = Base->getType(); CanQualType CBaseType = Context.getCanonicalType(BaseType); - if (!CTypes.insert(CBaseType)) { + if (!CTypes.insert(CBaseType).second) { Diag(OpLoc, diag::err_operator_arrow_circular) << StartingType; noteOperatorArrows(*this, OperatorArrows); return ExprError(); diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index a8f47d0047..a64a0fb323 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -1062,7 +1062,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // C++11 [expr.prim.lambda]p8: // An identifier or this shall not appear more than once in a // lambda-capture. - if (!CaptureNames.insert(C->Id)) { + if (!CaptureNames.insert(C->Id).second) { if (Var && LSI->isCaptured(Var)) { Diag(C->Loc, diag::err_capture_more_than_once) << C->Id << SourceRange(LSI->getCapture(Var).getLocation()) diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 783fccb0c8..44e3ce4f6b 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -128,7 +128,7 @@ namespace { // that contexts be visited from the inside out in order to get // the effective DCs right. void visit(DeclContext *DC, DeclContext *EffectiveDC) { - if (!visited.insert(DC)) + if (!visited.insert(DC).second) return; addUsingDirectives(DC, EffectiveDC); @@ -139,7 +139,7 @@ namespace { // were declared in the effective DC. void visit(UsingDirectiveDecl *UD, DeclContext *EffectiveDC) { DeclContext *NS = UD->getNominatedNamespace(); - if (!visited.insert(NS)) + if (!visited.insert(NS).second) return; addUsingDirective(UD, EffectiveDC); @@ -154,7 +154,7 @@ namespace { while (true) { for (auto UD : DC->using_directives()) { DeclContext *NS = UD->getNominatedNamespace(); - if (visited.insert(NS)) { + if (visited.insert(NS).second) { addUsingDirective(UD, EffectiveDC); queue.push_back(NS); } @@ -401,7 +401,7 @@ void LookupResult::resolveKind() { if (TypeDecl *TD = dyn_cast(D)) { if (!TD->getDeclContext()->isRecord()) { QualType T = getSema().Context.getTypeDeclType(TD); - if (!UniqueTypes.insert(getSema().Context.getCanonicalType(T))) { + if (!UniqueTypes.insert(getSema().Context.getCanonicalType(T)).second) { // The type is not unique; pull something off the back and continue // at this index. Decls[I] = Decls[--N]; @@ -410,7 +410,7 @@ void LookupResult::resolveKind() { } } - if (!Unique.insert(D)) { + if (!Unique.insert(D).second) { // If it's not unique, pull something off the back (and // continue at this index). Decls[I] = Decls[--N]; @@ -1452,7 +1452,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, // with its using-children. for (auto *I : UsingDirectives) { NamespaceDecl *ND = I->getNominatedNamespace()->getOriginalNamespace(); - if (Visited.insert(ND)) + if (Visited.insert(ND).second) Queue.push_back(ND); } @@ -1500,7 +1500,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, for (auto I : ND->using_directives()) { NamespaceDecl *Nom = I->getNominatedNamespace(); - if (Visited.insert(Nom)) + if (Visited.insert(Nom).second) Queue.push_back(Nom); } } @@ -2039,7 +2039,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, // FIXME: That's not correct, we may have added this class only because it // was the enclosing class of another class, and in that case we won't have // added its base classes yet. - if (!Result.Classes.insert(Class)) + if (!Result.Classes.insert(Class).second) return; // -- If T is a template-id, its associated namespaces and classes are @@ -2088,7 +2088,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, if (!BaseType) continue; CXXRecordDecl *BaseDecl = cast(BaseType->getDecl()); - if (Result.Classes.insert(BaseDecl)) { + if (Result.Classes.insert(BaseDecl).second) { // Find the associated namespace for this base class. DeclContext *BaseCtx = BaseDecl->getDeclContext(); CollectEnclosingNamespace(Result.Namespaces, BaseCtx); @@ -2890,7 +2890,7 @@ public: /// \brief Determine whether we have already visited this context /// (and, if not, note that we are going to visit that context now). bool visitedContext(DeclContext *Ctx) { - return !VisitedContexts.insert(Ctx); + return !VisitedContexts.insert(Ctx).second; } bool alreadyVisitedContext(DeclContext *Ctx) { diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 48aa18cd30..72b6020351 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -118,7 +118,7 @@ CheckPropertyAgainstProtocol(Sema &S, ObjCPropertyDecl *Prop, ObjCProtocolDecl *Proto, llvm::SmallPtrSetImpl &Known) { // Have we seen this protocol before? - if (!Known.insert(Proto)) + if (!Known.insert(Proto).second) return; // Look for a property with the same name. diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index d4b66b7a66..5e02647126 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -6675,7 +6675,7 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty, const Qualifiers &VisibleQuals) { // Insert this type. - if (!PointerTypes.insert(Ty)) + if (!PointerTypes.insert(Ty).second) return false; QualType PointeeTy; @@ -6743,7 +6743,7 @@ bool BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants( QualType Ty) { // Insert this type. - if (!MemberPointerTypes.insert(Ty)) + if (!MemberPointerTypes.insert(Ty).second) return false; const MemberPointerType *PointerTy = Ty->getAs(); @@ -7313,7 +7313,7 @@ public: MemPtr != MemPtrEnd; ++MemPtr) { // Don't add the same builtin candidate twice. - if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr)).second) continue; QualType ParamTypes[2] = { *MemPtr, *MemPtr }; @@ -7388,7 +7388,7 @@ public: PtrEnd = CandidateTypes[ArgIdx].pointer_end(); Ptr != PtrEnd; ++Ptr) { // Don't add the same builtin candidate twice. - if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr)).second) continue; QualType ParamTypes[2] = { *Ptr, *Ptr }; @@ -7402,7 +7402,7 @@ public: // Don't add the same builtin candidate twice, or if a user defined // candidate exists. - if (!AddedTypes.insert(CanonType) || + if (!AddedTypes.insert(CanonType).second || UserDefinedBinaryOperators.count(std::make_pair(CanonType, CanonType))) continue; @@ -7413,7 +7413,7 @@ public: if (CandidateTypes[ArgIdx].hasNullPtrType()) { CanQualType NullPtrTy = S.Context.getCanonicalType(S.Context.NullPtrTy); - if (AddedTypes.insert(NullPtrTy) && + if (AddedTypes.insert(NullPtrTy).second && !UserDefinedBinaryOperators.count(std::make_pair(NullPtrTy, NullPtrTy))) { QualType ParamTypes[2] = { NullPtrTy, NullPtrTy }; @@ -7466,7 +7466,7 @@ public: } if (Op == OO_Minus) { // ptrdiff_t operator-(T, T); - if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr)).second) continue; QualType ParamTypes[2] = { *Ptr, *Ptr }; @@ -7595,7 +7595,7 @@ public: Enum = CandidateTypes[ArgIdx].enumeration_begin(), EnumEnd = CandidateTypes[ArgIdx].enumeration_end(); Enum != EnumEnd; ++Enum) { - if (!AddedTypes.insert(S.Context.getCanonicalType(*Enum))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Enum)).second) continue; AddBuiltinAssignmentOperatorCandidates(S, *Enum, Args, CandidateSet); @@ -7605,7 +7605,7 @@ public: MemPtr = CandidateTypes[ArgIdx].member_pointer_begin(), MemPtrEnd = CandidateTypes[ArgIdx].member_pointer_end(); MemPtr != MemPtrEnd; ++MemPtr) { - if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr)).second) continue; AddBuiltinAssignmentOperatorCandidates(S, *MemPtr, Args, CandidateSet); @@ -7688,7 +7688,7 @@ public: PtrEnd = CandidateTypes[1].pointer_end(); Ptr != PtrEnd; ++Ptr) { // Make sure we don't add the same candidate twice. - if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr)).second) continue; QualType ParamTypes[2] = { @@ -7969,7 +7969,7 @@ public: Ptr = CandidateTypes[ArgIdx].pointer_begin(), PtrEnd = CandidateTypes[ArgIdx].pointer_end(); Ptr != PtrEnd; ++Ptr) { - if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Ptr)).second) continue; QualType ParamTypes[2] = { *Ptr, *Ptr }; @@ -7980,7 +7980,7 @@ public: MemPtr = CandidateTypes[ArgIdx].member_pointer_begin(), MemPtrEnd = CandidateTypes[ArgIdx].member_pointer_end(); MemPtr != MemPtrEnd; ++MemPtr) { - if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*MemPtr)).second) continue; QualType ParamTypes[2] = { *MemPtr, *MemPtr }; @@ -7995,7 +7995,7 @@ public: if (!(*Enum)->getAs()->getDecl()->isScoped()) continue; - if (!AddedTypes.insert(S.Context.getCanonicalType(*Enum))) + if (!AddedTypes.insert(S.Context.getCanonicalType(*Enum)).second) continue; QualType ParamTypes[2] = { *Enum, *Enum }; diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 3fff8b1c86..08ab0a0726 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -107,7 +107,7 @@ void Sema::FilterAcceptableTemplateNames(LookupResult &R, // template itself and not a specialization thereof, and is not // ambiguous. if (ClassTemplateDecl *ClassTmpl = dyn_cast(Repl)) - if (!ClassTemplates.insert(ClassTmpl)) { + if (!ClassTemplates.insert(ClassTmpl).second) { filter.erase(); continue; } diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 5cc720f488..221a84d76d 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1493,7 +1493,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, const RecordType *NextT = ToVisit.pop_back_val(); // If we have already seen this type, skip it. - if (!Visited.insert(NextT)) + if (!Visited.insert(NextT).second) continue; // If this is a base class, try to perform template argument diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index 52875465e6..f5883e429d 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -244,7 +244,7 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, else Name = Unexpanded[I].first.get()->getIdentifier(); - if (Name && NamesKnown.insert(Name)) + if (Name && NamesKnown.insert(Name).second) Names.push_back(Name); if (Unexpanded[I].second.isValid()) diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 9c95a0cb26..1bbadfcee7 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -3525,7 +3525,7 @@ void ASTReader::makeModuleVisible(Module *Mod, for (SmallVectorImpl::iterator I = Exports.begin(), E = Exports.end(); I != E; ++I) { Module *Exported = *I; - if (Visited.insert(Exported)) + if (Visited.insert(Exported).second) Stack.push_back(Exported); } @@ -8414,7 +8414,7 @@ void ASTReader::diagnoseOdrViolations() { for (auto &Merge : OdrMergeFailures) { // If we've already pointed out a specific problem with this class, don't // bother issuing a general "something's different" diagnostic. - if (!DiagnosedOdrMergeFailures.insert(Merge.first)) + if (!DiagnosedOdrMergeFailures.insert(Merge.first).second) continue; bool Diagnosed = false; diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 75ac2c3422..a783183d2e 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -143,7 +143,7 @@ namespace clang { ~RedeclarableResult() { if (FirstID && Owning && isRedeclarableDeclKind(DeclKind) && - Reader.PendingDeclChainsKnown.insert(FirstID)) + Reader.PendingDeclChainsKnown.insert(FirstID).second) Reader.PendingDeclChains.push_back(FirstID); } diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 3fe6008a94..b9be775408 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -3680,7 +3680,7 @@ static void visitLocalLookupResults(const DeclContext *ConstDC, } void ASTWriter::AddUpdatedDeclContext(const DeclContext *DC) { - if (UpdatedDeclContexts.insert(DC) && WritingAST) { + if (UpdatedDeclContexts.insert(DC).second && WritingAST) { // Ensure we emit all the visible declarations. visitLocalLookupResults(DC, DC->NeedToReconcileExternalVisibleStorage, [&](DeclarationName Name, diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index 151b9df7bc..45056226c9 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -709,7 +709,7 @@ public: } bool AddToWorkList(WorkListElement E, const ClusterBindings *C) { - if (C && !Visited.insert(C)) + if (C && !Visited.insert(C).second) return false; WL.push_back(E); return true; -- 2.40.0