[llvm] r290617 - ASMParser: use range-based for loops (NFC)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 27 10:35:23 PST 2016


Author: compnerd
Date: Tue Dec 27 12:35:22 2016
New Revision: 290617

URL: http://llvm.org/viewvc/llvm-project?rev=290617&view=rev
Log:
ASMParser: use range-based for loops (NFC)

Convert the verify method to use a few more range based for loops,
converting to const iterators in the process.

Modified:
    llvm/trunk/lib/AsmParser/LLParser.cpp

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=290617&r1=290616&r2=290617&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Dec 27 12:35:22 2016
@@ -121,16 +121,13 @@ void LLParser::restoreParsingState(const
 /// module.
 bool LLParser::ValidateEndOfModule() {
   // Handle any function attribute group forward references.
-  for (std::map<Value*, std::vector<unsigned> >::iterator
-         I = ForwardRefAttrGroups.begin(), E = ForwardRefAttrGroups.end();
-         I != E; ++I) {
-    Value *V = I->first;
-    std::vector<unsigned> &Vec = I->second;
+  for (const auto &RAG : ForwardRefAttrGroups) {
+    Value *V = RAG.first;
+    const std::vector<unsigned> &Attrs = RAG.second;
     AttrBuilder B;
 
-    for (std::vector<unsigned>::iterator VI = Vec.begin(), VE = Vec.end();
-         VI != VE; ++VI)
-      B.merge(NumberedAttrBuilders[*VI]);
+    for (const auto &Attr : Attrs)
+      B.merge(NumberedAttrBuilders[Attr]);
 
     if (Function *Fn = dyn_cast<Function>(V)) {
       AttributeSet AS = Fn->getAttributes();




More information about the llvm-commits mailing list