<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 12:00 PM, Aaron Ballman via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: aaronballman<br>
Date: Wed Aug 12 14:00:39 2015<br>
New Revision: 244792<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=244792&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=244792&view=rev</a><br>
Log:<br>
RangRangify some more for loops; NFC.<br>
<br>
Modified:<br>
    cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp<br>
<br>
Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)<br>
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 14:00:39 2015<br>
@@ -358,11 +358,8 @@ RegistryMaps::RegistryMaps() {<br>
 }<br>
<br>
 RegistryMaps::~RegistryMaps() {<br>
-  for (ConstructorMap::iterator it = Constructors.begin(),<br>
-                                end = Constructors.end();<br>
-       it != end; ++it) {<br>
-    delete it->second;<br>
-  }<br>
+  for (auto &E : Constructors)<br>
+    delete E.getValue();<br></blockquote><div><br>This looks like "DeleteContainerSeconds" (but even better if they could be switched to unique_ptr)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 }<br>
<br>
 static llvm::ManagedStatic<RegistryMaps> RegistryData;<br>
@@ -433,12 +430,13 @@ Registry::getMatcherCompletions(ArrayRef<br>
   std::vector<MatcherCompletion> Completions;<br>
<br>
   // Search the registry for acceptable matchers.<br>
-  for (ConstructorMap::const_iterator I = RegistryData->constructors().begin(),<br>
-                                      E = RegistryData->constructors().end();<br>
-       I != E; ++I) {<br>
+  for (const auto &M : RegistryData->constructors()) {<br>
+    const auto *Matcher = M.getValue();<br>
+    StringRef Name = M.getKey();<br>
+<br>
     std::set<ASTNodeKind> RetKinds;<br>
-    unsigned NumArgs = I->second->isVariadic() ? 1 : I->second->getNumArgs();<br>
-    bool IsPolymorphic = I->second->isPolymorphic();<br>
+    unsigned NumArgs = Matcher->isVariadic() ? 1 : Matcher->getNumArgs();<br>
+    bool IsPolymorphic = Matcher->isPolymorphic();<br>
     std::vector<std::vector<ArgKind>> ArgsKinds(NumArgs);<br>
     unsigned MaxSpecificity = 0;<br>
     for (const ArgKind& Kind : AcceptedTypes) {<br>
@@ -446,13 +444,13 @@ Registry::getMatcherCompletions(ArrayRef<br>
         continue;<br>
       unsigned Specificity;<br>
       ASTNodeKind LeastDerivedKind;<br>
-      if (I->second->isConvertibleTo(Kind.getMatcherKind(), &Specificity,<br>
-                                     &LeastDerivedKind)) {<br>
+      if (Matcher->isConvertibleTo(Kind.getMatcherKind(), &Specificity,<br>
+                                   &LeastDerivedKind)) {<br>
         if (MaxSpecificity < Specificity)<br>
           MaxSpecificity = Specificity;<br>
         RetKinds.insert(LeastDerivedKind);<br>
         for (unsigned Arg = 0; Arg != NumArgs; ++Arg)<br>
-          I->second->getArgKinds(Kind.getMatcherKind(), Arg, ArgsKinds[Arg]);<br>
+          Matcher->getArgKinds(Kind.getMatcherKind(), Arg, ArgsKinds[Arg]);<br>
         if (IsPolymorphic)<br>
           break;<br>
       }<br>
@@ -463,9 +461,9 @@ Registry::getMatcherCompletions(ArrayRef<br>
       llvm::raw_string_ostream OS(Decl);<br>
<br>
       if (IsPolymorphic) {<br>
-        OS << "Matcher<T> " << I->first() << "(Matcher<T>";<br>
+        OS << "Matcher<T> " << Name << "(Matcher<T>";<br>
       } else {<br>
-        OS << "Matcher<" << RetKinds << "> " << I->first() << "(";<br>
+        OS << "Matcher<" << RetKinds << "> " << Name << "(";<br>
         for (const std::vector<ArgKind> &Arg : ArgsKinds) {<br>
           if (&Arg != &ArgsKinds[0])<br>
             OS << ", ";<br>
@@ -488,11 +486,11 @@ Registry::getMatcherCompletions(ArrayRef<br>
           }<br>
         }<br>
       }<br>
-      if (I->second->isVariadic())<br>
+      if (Matcher->isVariadic())<br>
         OS << "...";<br>
       OS << ")";<br>
<br>
-      std::string TypedText = I->first();<br>
+      std::string TypedText = Name;<br>
       TypedText += "(";<br>
       if (ArgsKinds.empty())<br>
         TypedText += ")";<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>