For the record, Clang is compiled with -fno-exceptions and is not exception-safe. But, good point.
Jordan On Aug 23, 2013, at 13:30 , Arthur O'Dwyer <[email protected]> wrote: > FYI, the "assign from back() and then pop if successful" idiom is > often employed in template situations where it's conceivable that the > relevant constructor or assignment operator could throw an exception. > That said, I'm 99% sure that this patch is totally fine, since AFAICT > it's dealing entirely with Clang-controlled types that never throw > exceptions. > > –Arthur > > > On Fri, Aug 23, 2013 at 9:11 AM, Robert Wilhelm <[email protected]> > wrote: >> Author: row >> Date: Fri Aug 23 11:11:15 2013 >> New Revision: 189112 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=189112&view=rev >> Log: >> Use pop_back_val() instead of both back() and pop_back(). >> No functionality change intended. >> >> Modified: >> cfe/trunk/include/clang/AST/ASTUnresolvedSet.h >> cfe/trunk/include/clang/AST/CommentParser.h >> cfe/trunk/include/clang/AST/UnresolvedSet.h >> cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h >> cfe/trunk/include/clang/Lex/PreprocessorLexer.h >> cfe/trunk/lib/AST/CXXInheritance.cpp >> cfe/trunk/lib/AST/CommentSema.cpp >> cfe/trunk/lib/AST/NestedNameSpecifier.cpp >> cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp >> cfe/trunk/lib/Analysis/LiveVariables.cpp >> cfe/trunk/lib/Analysis/UninitializedValues.cpp >> cfe/trunk/lib/CodeGen/CodeGenModule.cpp >> cfe/trunk/lib/Lex/TokenLexer.cpp >> cfe/trunk/lib/Sema/Sema.cpp >> cfe/trunk/lib/Sema/SemaAccess.cpp >> cfe/trunk/lib/Sema/SemaChecking.cpp >> cfe/trunk/lib/Sema/SemaCodeComplete.cpp >> cfe/trunk/lib/Sema/SemaDeclCXX.cpp >> cfe/trunk/lib/Sema/SemaLookup.cpp >> cfe/trunk/lib/Sema/SemaTemplate.cpp >> cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp >> cfe/trunk/lib/Serialization/ASTReader.cpp >> cfe/trunk/lib/Serialization/ModuleManager.cpp >> cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp >> cfe/trunk/tools/libclang/CIndex.cpp >> >> Modified: cfe/trunk/include/clang/AST/ASTUnresolvedSet.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTUnresolvedSet.h?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/AST/ASTUnresolvedSet.h (original) >> +++ cfe/trunk/include/clang/AST/ASTUnresolvedSet.h Fri Aug 23 11:11:15 2013 >> @@ -58,10 +58,7 @@ public: >> return false; >> } >> >> - void erase(unsigned I) { >> - Decls[I] = Decls.back(); >> - Decls.pop_back(); >> - } >> + void erase(unsigned I) { Decls[I] = Decls.pop_back_val(); } >> >> void clear() { Decls.clear(); } >> >> >> Modified: cfe/trunk/include/clang/AST/CommentParser.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentParser.h?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/AST/CommentParser.h (original) >> +++ cfe/trunk/include/clang/AST/CommentParser.h Fri Aug 23 11:11:15 2013 >> @@ -61,10 +61,8 @@ class Parser { >> void consumeToken() { >> if (MoreLATokens.empty()) >> L.lex(Tok); >> - else { >> - Tok = MoreLATokens.back(); >> - MoreLATokens.pop_back(); >> - } >> + else >> + Tok = MoreLATokens.pop_back_val(); >> } >> >> void putBack(const Token &OldTok) { >> >> Modified: cfe/trunk/include/clang/AST/UnresolvedSet.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/UnresolvedSet.h?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/AST/UnresolvedSet.h (original) >> +++ cfe/trunk/include/clang/AST/UnresolvedSet.h Fri Aug 23 11:11:15 2013 >> @@ -139,15 +139,9 @@ public: >> I.ir->set(New, AS); >> } >> >> - void erase(unsigned I) { >> - decls()[I] = decls().back(); >> - decls().pop_back(); >> - } >> + void erase(unsigned I) { decls()[I] = decls().pop_back_val(); } >> >> - void erase(iterator I) { >> - *I.ir = decls().back(); >> - decls().pop_back(); >> - } >> + void erase(iterator I) { *I.ir = decls().pop_back_val(); } >> >> void setAccess(iterator I, AccessSpecifier AS) { >> I.ir->setAccess(AS); >> >> Modified: cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h >> (original) >> +++ cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h Fri Aug >> 23 11:11:15 2013 >> @@ -45,8 +45,7 @@ public: >> /// dequeue - Remove a block from the worklist. >> const CFGBlock *dequeue() { >> assert(!BlockQueue.empty()); >> - const CFGBlock *B = BlockQueue.back(); >> - BlockQueue.pop_back(); >> + const CFGBlock *B = BlockQueue.pop_back_val(); >> BlockSet[B] = 0; >> return B; >> } >> >> Modified: cfe/trunk/include/clang/Lex/PreprocessorLexer.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessorLexer.h?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Lex/PreprocessorLexer.h (original) >> +++ cfe/trunk/include/clang/Lex/PreprocessorLexer.h Fri Aug 23 11:11:15 2013 >> @@ -111,9 +111,9 @@ protected: >> /// stack, returning information about it. If the conditional stack is >> empty, >> /// this returns true and does not fill in the arguments. >> bool popConditionalLevel(PPConditionalInfo &CI) { >> - if (ConditionalStack.empty()) return true; >> - CI = ConditionalStack.back(); >> - ConditionalStack.pop_back(); >> + if (ConditionalStack.empty()) >> + return true; >> + CI = ConditionalStack.pop_back_val(); >> return false; >> } >> >> >> Modified: cfe/trunk/lib/AST/CXXInheritance.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/AST/CXXInheritance.cpp (original) >> +++ cfe/trunk/lib/AST/CXXInheritance.cpp Fri Aug 23 11:11:15 2013 >> @@ -168,9 +168,9 @@ bool CXXRecordDecl::forallBases(ForallBa >> } >> } >> >> - if (Queue.empty()) break; >> - Record = Queue.back(); // not actually a queue. >> - Queue.pop_back(); >> + if (Queue.empty()) >> + break; >> + Record = Queue.pop_back_val(); // not actually a queue. >> } >> >> return AllMatches; >> >> Modified: cfe/trunk/lib/AST/CommentSema.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/AST/CommentSema.cpp (original) >> +++ cfe/trunk/lib/AST/CommentSema.cpp Fri Aug 23 11:11:15 2013 >> @@ -515,8 +515,7 @@ HTMLEndTagComment *Sema::actOnHTMLEndTag >> } >> >> while (!HTMLOpenTags.empty()) { >> - const HTMLStartTagComment *HST = HTMLOpenTags.back(); >> - HTMLOpenTags.pop_back(); >> + const HTMLStartTagComment *HST = HTMLOpenTags.pop_back_val(); >> StringRef LastNotClosedTagName = HST->getTagName(); >> if (LastNotClosedTagName == TagName) >> break; >> >> Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original) >> +++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Fri Aug 23 11:11:15 2013 >> @@ -566,8 +566,7 @@ void NestedNameSpecifierLocBuilder::Make >> for (NestedNameSpecifier *NNS = Qualifier; NNS; NNS = NNS->getPrefix()) >> Stack.push_back(NNS); >> while (!Stack.empty()) { >> - NestedNameSpecifier *NNS = Stack.back(); >> - Stack.pop_back(); >> + NestedNameSpecifier *NNS = Stack.pop_back_val(); >> switch (NNS->getKind()) { >> case NestedNameSpecifier::Identifier: >> case NestedNameSpecifier::Namespace: >> >> Modified: cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp (original) >> +++ cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp Fri Aug 23 11:11:15 >> 2013 >> @@ -50,11 +50,10 @@ void CFGReverseBlockReachabilityAnalysis >> // multiple queries relating to a destination node. >> worklist.push_back(Dst); >> bool firstRun = true; >> - >> - while (!worklist.empty()) { >> - const CFGBlock *block = worklist.back(); >> - worklist.pop_back(); >> - >> + >> + while (!worklist.empty()) { >> + const CFGBlock *block = worklist.pop_back_val(); >> + >> if (visited[block->getBlockID()]) >> continue; >> visited[block->getBlockID()] = true; >> >> Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Analysis/LiveVariables.cpp (original) >> +++ cfe/trunk/lib/Analysis/LiveVariables.cpp Fri Aug 23 11:11:15 2013 >> @@ -87,8 +87,7 @@ void DataflowWorklist::sortWorklist() { >> const CFGBlock *DataflowWorklist::dequeue() { >> if (worklist.empty()) >> return 0; >> - const CFGBlock *b = worklist.back(); >> - worklist.pop_back(); >> + const CFGBlock *b = worklist.pop_back_val(); >> enqueuedBlocks[b->getBlockID()] = false; >> return b; >> } >> >> Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original) >> +++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Fri Aug 23 11:11:15 2013 >> @@ -240,10 +240,9 @@ const CFGBlock *DataflowWorklist::dequeu >> >> // First dequeue from the worklist. This can represent >> // updates along backedges that we want propagated as quickly as possible. >> - if (!worklist.empty()) { >> - B = worklist.back(); >> - worklist.pop_back(); >> - } >> + if (!worklist.empty()) >> + B = worklist.pop_back_val(); >> + >> // Next dequeue from the initial reverse post order. This is the >> // theoretical ideal in the presence of no back edges. >> else if (PO_I != PO_E) { >> @@ -527,8 +526,7 @@ public: >> // of marking it as not being a candidate element of the frontier. >> SuccsVisited[block->getBlockID()] = block->succ_size(); >> while (!Queue.empty()) { >> - const CFGBlock *B = Queue.back(); >> - Queue.pop_back(); >> + const CFGBlock *B = Queue.pop_back_val(); >> for (CFGBlock::const_pred_iterator I = B->pred_begin(), E = >> B->pred_end(); >> I != E; ++I) { >> const CFGBlock *Pred = *I; >> >> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) >> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Aug 23 11:11:15 2013 >> @@ -863,8 +863,7 @@ void CodeGenModule::EmitModuleLinkOption >> // Find all of the modules to import, making a little effort to prune >> // non-leaf modules. >> while (!Stack.empty()) { >> - clang::Module *Mod = Stack.back(); >> - Stack.pop_back(); >> + clang::Module *Mod = Stack.pop_back_val(); >> >> bool AnyChildren = false; >> >> >> Modified: cfe/trunk/lib/Lex/TokenLexer.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Lex/TokenLexer.cpp (original) >> +++ cfe/trunk/lib/Lex/TokenLexer.cpp Fri Aug 23 11:11:15 2013 >> @@ -329,8 +329,7 @@ void TokenLexer::ExpandFunctionArguments >> (unsigned)ArgNo == Macro->getNumArgs()-1 && >> Macro->isVariadic()) { >> // Remove the paste operator, report use of the extension. >> - PP.Diag(ResultToks.back().getLocation(), diag::ext_paste_comma); >> - ResultToks.pop_back(); >> + PP.Diag(ResultToks.pop_back_val().getLocation(), >> diag::ext_paste_comma); >> } >> >> ResultToks.append(ArgToks, ArgToks+NumToks); >> @@ -386,8 +385,7 @@ void TokenLexer::ExpandFunctionArguments >> assert(PasteBefore); >> if (NonEmptyPasteBefore) { >> assert(ResultToks.back().is(tok::hashhash)); >> - NextTokGetsSpace |= ResultToks.back().hasLeadingSpace(); >> - ResultToks.pop_back(); >> + NextTokGetsSpace |= ResultToks.pop_back_val().hasLeadingSpace(); >> } >> >> // If this is the __VA_ARGS__ token, and if the argument wasn't provided, >> >> Modified: cfe/trunk/lib/Sema/Sema.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/Sema.cpp (original) >> +++ cfe/trunk/lib/Sema/Sema.cpp Fri Aug 23 11:11:15 2013 >> @@ -630,8 +630,7 @@ void Sema::ActOnEndOfTranslationUnit() { >> SmallVector<Module *, 2> Stack; >> Stack.push_back(CurrentModule); >> while (!Stack.empty()) { >> - Module *Mod = Stack.back(); >> - Stack.pop_back(); >> + Module *Mod = Stack.pop_back_val(); >> >> // Resolve the exported declarations and conflicts. >> // FIXME: Actually complain, once we figure out how to teach the >> >> Modified: cfe/trunk/lib/Sema/SemaAccess.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaAccess.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaAccess.cpp Fri Aug 23 11:11:15 2013 >> @@ -315,8 +315,7 @@ static AccessResult IsDerivedFromInclusi >> >> if (Queue.empty()) break; >> >> - Derived = Queue.back(); >> - Queue.pop_back(); >> + Derived = Queue.pop_back_val(); >> } >> >> return OnFailure; >> >> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Aug 23 11:11:15 2013 >> @@ -6031,8 +6031,7 @@ void Sema::CheckUnsequencedOperations(Ex >> SmallVector<Expr *, 8> WorkList; >> WorkList.push_back(E); >> while (!WorkList.empty()) { >> - Expr *Item = WorkList.back(); >> - WorkList.pop_back(); >> + Expr *Item = WorkList.pop_back_val(); >> SequenceChecker(*this, Item, WorkList); >> } >> } >> >> Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Aug 23 11:11:15 2013 >> @@ -464,9 +464,8 @@ getRequiredQualification(ASTContext &Con >> >> NestedNameSpecifier *Result = 0; >> while (!TargetParents.empty()) { >> - const DeclContext *Parent = TargetParents.back(); >> - TargetParents.pop_back(); >> - >> + const DeclContext *Parent = TargetParents.pop_back_val(); >> + >> if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(Parent)) { >> if (!Namespace->getIdentifier()) >> continue; >> >> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 23 11:11:15 2013 >> @@ -1249,8 +1249,7 @@ static bool findCircularInheritance(cons >> if (Queue.empty()) >> return false; >> >> - Current = Queue.back(); >> - Queue.pop_back(); >> + Current = Queue.pop_back_val(); >> } >> >> return false; >> >> Modified: cfe/trunk/lib/Sema/SemaLookup.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Aug 23 11:11:15 2013 >> @@ -167,8 +167,7 @@ namespace { >> if (queue.empty()) >> return; >> >> - DC = queue.back(); >> - queue.pop_back(); >> + DC = queue.pop_back_val(); >> } >> } >> >> @@ -1446,8 +1445,7 @@ static bool LookupQualifiedNameInUsingDi >> >> bool Found = false; >> while (!Queue.empty()) { >> - NamespaceDecl *ND = Queue.back(); >> - Queue.pop_back(); >> + NamespaceDecl *ND = Queue.pop_back_val(); >> >> // We go through some convolutions here to avoid copying results >> // between LookupResults. >> @@ -2039,8 +2037,7 @@ addAssociatedClassesAndNamespaces(Associ >> Bases.push_back(Class); >> while (!Bases.empty()) { >> // Pop this class off the stack. >> - Class = Bases.back(); >> - Bases.pop_back(); >> + Class = Bases.pop_back_val(); >> >> // Visit the base classes. >> for (CXXRecordDecl::base_class_iterator Base = Class->bases_begin(), >> @@ -2224,9 +2221,9 @@ addAssociatedClassesAndNamespaces(Associ >> continue; >> } >> >> - if (Queue.empty()) break; >> - T = Queue.back(); >> - Queue.pop_back(); >> + if (Queue.empty()) >> + break; >> + T = Queue.pop_back_val(); >> } >> } >> >> >> Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Aug 23 11:11:15 2013 >> @@ -3527,8 +3527,7 @@ bool Sema::CheckTemplateArgumentList(Tem >> // deduced argument and place it on the argument pack. Note that we >> // stay on the same template parameter so that we can deduce more >> // arguments. >> - ArgumentPack.push_back(Converted.back()); >> - Converted.pop_back(); >> + ArgumentPack.push_back(Converted.pop_back_val()); >> } else { >> // Move to the next template parameter. >> ++Param; >> >> Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Aug 23 11:11:15 2013 >> @@ -1431,8 +1431,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema >> Deduced.end()); >> while (!ToVisit.empty()) { >> // Retrieve the next class in the inheritance hierarchy. >> - const RecordType *NextT = ToVisit.back(); >> - ToVisit.pop_back(); >> + const RecordType *NextT = ToVisit.pop_back_val(); >> >> // If we have already seen this type, skip it. >> if (!Visited.insert(NextT)) >> @@ -2091,8 +2090,7 @@ ConvertDeducedTemplateArgument(Sema &S, >> return true; >> >> // Move the converted template argument into our argument pack. >> - PackedArgsBuilder.push_back(Output.back()); >> - Output.pop_back(); >> + PackedArgsBuilder.push_back(Output.pop_back_val()); >> } >> >> // Create the resulting argument pack. >> >> Modified: cfe/trunk/lib/Serialization/ASTReader.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) >> +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Aug 23 11:11:15 2013 >> @@ -2819,13 +2819,12 @@ void ASTReader::makeModuleVisible(Module >> bool Complain) { >> llvm::SmallPtrSet<Module *, 4> Visited; >> SmallVector<Module *, 4> Stack; >> - Stack.push_back(Mod); >> + Stack.push_back(Mod); >> while (!Stack.empty()) { >> - Mod = Stack.back(); >> - Stack.pop_back(); >> + Mod = Stack.pop_back_val(); >> >> if (NameVisibility <= Mod->NameVisibility) { >> - // This module already has this level of visibility (or greater), so >> + // This module already has this level of visibility (or greater), so >> // there is nothing more to do. >> continue; >> } >> >> Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Serialization/ModuleManager.cpp (original) >> +++ cfe/trunk/lib/Serialization/ModuleManager.cpp Fri Aug 23 11:11:15 2013 >> @@ -332,8 +332,7 @@ ModuleManager::visit(bool (*Visitor)(Mod >> break; >> >> // Pop the next module off the stack. >> - NextModule = State->Stack.back(); >> - State->Stack.pop_back(); >> + NextModule = State->Stack.pop_back_val(); >> } while (true); >> } >> >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp Fri Aug 23 >> 11:11:15 2013 >> @@ -85,10 +85,9 @@ void ReachableCode::computeReachableBloc >> >> SmallVector<const CFGBlock*, 10> worklist; >> worklist.push_back(&cfg.getEntry()); >> - >> + >> while (!worklist.empty()) { >> - const CFGBlock *block = worklist.back(); >> - worklist.pop_back(); >> + const CFGBlock *block = worklist.pop_back_val(); >> llvm::BitVector::reference isReachable = reachable[block->getBlockID()]; >> if (isReachable) >> continue; >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri Aug 23 11:11:15 >> 2013 >> @@ -2651,10 +2651,8 @@ void BugReport::pushInterestingSymbolsAn >> } >> >> void BugReport::popInterestingSymbolsAndRegions() { >> - delete interestingSymbols.back(); >> - interestingSymbols.pop_back(); >> - delete interestingRegions.back(); >> - interestingRegions.pop_back(); >> + delete interestingSymbols.pop_back_val(); >> + delete interestingRegions.pop_back_val(); >> } >> >> const Stmt *BugReport::getStmt() const { >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Fri Aug 23 11:11:15 >> 2013 >> @@ -357,8 +357,7 @@ ExplodedGraph::trim(ArrayRef<const NodeT >> >> // Process the first worklist until it is empty. >> while (!WL1.empty()) { >> - const ExplodedNode *N = WL1.back(); >> - WL1.pop_back(); >> + const ExplodedNode *N = WL1.pop_back_val(); >> >> // Have we already visited this node? If so, continue to the next one. >> if (Pass1.count(N)) >> @@ -388,8 +387,7 @@ ExplodedGraph::trim(ArrayRef<const NodeT >> >> // ===- Pass 2 (forward DFS to construct the new graph) -=== >> while (!WL2.empty()) { >> - const ExplodedNode *N = WL2.back(); >> - WL2.pop_back(); >> + const ExplodedNode *N = WL2.pop_back_val(); >> >> // Skip this node if we have already processed it. >> if (Pass2.find(N) != Pass2.end()) >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Fri Aug 23 11:11:15 >> 2013 >> @@ -216,11 +216,10 @@ void PathDiagnosticConsumer::HandlePathD >> WorkList.push_back(&D->path); >> >> while (!WorkList.empty()) { >> - const PathPieces &path = *WorkList.back(); >> - WorkList.pop_back(); >> + const PathPieces &path = *WorkList.pop_back_val(); >> >> - for (PathPieces::const_iterator I = path.begin(), E = path.end(); >> - I != E; ++I) { >> + for (PathPieces::const_iterator I = path.begin(), E = path.end(); I >> != E; >> + ++I) { >> const PathDiagnosticPiece *piece = I->getPtr(); >> FullSourceLoc L = >> piece->getLocation().asLocation().getExpansionLoc(); >> >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Fri Aug 23 >> 11:11:15 2013 >> @@ -382,11 +382,10 @@ void PlistDiagnostics::FlushDiagnosticsI >> WorkList.push_back(&D->path); >> >> while (!WorkList.empty()) { >> - const PathPieces &path = *WorkList.back(); >> - WorkList.pop_back(); >> - >> - for (PathPieces::const_iterator I = path.begin(), E = path.end(); >> - I!=E; ++I) { >> + const PathPieces &path = *WorkList.pop_back_val(); >> + >> + for (PathPieces::const_iterator I = path.begin(), E = path.end(); I >> != E; >> + ++I) { >> const PathDiagnosticPiece *piece = I->getPtr(); >> AddFID(FM, Fids, SM, piece->getLocation().asLocation()); >> ArrayRef<SourceRange> Ranges = piece->getRanges(); >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp Fri Aug 23 11:11:15 >> 2013 >> @@ -112,8 +112,7 @@ SymbolRef SymExpr::symbol_iterator::oper >> } >> >> void SymExpr::symbol_iterator::expand() { >> - const SymExpr *SE = itr.back(); >> - itr.pop_back(); >> + const SymExpr *SE = itr.pop_back_val(); >> >> switch (SE->getKind()) { >> case SymExpr::RegionValueKind: >> >> Modified: cfe/trunk/tools/libclang/CIndex.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=189112&r1=189111&r2=189112&view=diff >> ============================================================================== >> --- cfe/trunk/tools/libclang/CIndex.cpp (original) >> +++ cfe/trunk/tools/libclang/CIndex.cpp Fri Aug 23 11:11:15 2013 >> @@ -2256,8 +2256,7 @@ bool CursorVisitor::IsInRegionOfInterest >> bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) { >> while (!WL.empty()) { >> // Dequeue the worklist item. >> - VisitorJob LI = WL.back(); >> - WL.pop_back(); >> + VisitorJob LI = WL.pop_back_val(); >> >> // Set the Parent field, then back to its old value once we're done. >> SetParentRAII SetParent(Parent, StmtParent, LI.getParent()); >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
