[PATCH] D15388: [Clang] Use autos in lib/AST/Expr.cpp

Eugene Zelenko via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 11:54:45 PST 2015


Eugene.Zelenko added inline comments.

================
Comment at: lib/AST/Expr.cpp:1956
@@ -1967,1 +1955,3 @@
+    for (const auto &I : InitExprs) {
+      if (Stmt *S = I) {
         Beg = S->getLocStart();
----------------
aaron.ballman wrote:
> Is this line still required? I thought InitExprs was already a vector of Stmt objects. I think it should be a const auto * instead of const auto & as well.
Will fix in commit.

================
Comment at: lib/AST/Expr.cpp:3715
@@ -3741,3 +3714,3 @@
   assert(D.Kind == Designator::ArrayDesignator && "Requires array designator");
-  Stmt *const *SubExprs = reinterpret_cast<Stmt *const *>(this + 1);
+  auto SubExprs = reinterpret_cast<Stmt *const *>(this + 1);
   return cast<Expr>(*(SubExprs + D.ArrayOrRange.Index + 1));
----------------
aaron.ballman wrote:
> Hmmm, I'm not certain this is an improvement. It lacks the information that SubExprs is a pointer to a pointer, and it lacks the constness information. I would revert this one (and the next two).
But all of this is mentioned in reinterpret_cast.


Repository:
  rL LLVM

http://reviews.llvm.org/D15388





More information about the cfe-commits mailing list