[PATCH] Use 'auto const&' for iterators whose deref operator returns a const var

Manuel Klimek klimek at google.com
Tue Apr 9 01:40:05 PDT 2013



================
Comment at: cpp11-migrate/LoopConvert/LoopActions.cpp:789
@@ +788,3 @@
+      if (IteratorPointsToConst)
+        AutoRefType = Context->getConstType(AutoRefType);
+
----------------
This looks like a no-op. else { intended?

================
Comment at: cpp11-migrate/LoopConvert/LoopActions.cpp:1010
@@ +1009,3 @@
+          Nodes.getNodeAs<QualType>(DerefByRefResultName);
+      if (IteratorType) {
+        const ReferenceType *IteratorReferenceType =
----------------
Style hint: it's common llvm style to use
if (const QualType* IteratorType = ...) {
}
-> makes the scope of IteratorType smaller.


http://llvm-reviews.chandlerc.com/D641



More information about the cfe-commits mailing list