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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 12:01:31 PST 2015


aaron.ballman added inline comments.

================
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));
----------------
Eugene.Zelenko wrote:
> 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.
It is, but our usual rule is to put the cv-qualifiers and &/* as part of the auto signature so that the type properties are easier to identify, which is what makes this one kind of challenging. Since Stmt is the same length as auto, I think leaving it as-is may be less confusing.


Repository:
  rL LLVM

http://reviews.llvm.org/D15388





More information about the cfe-commits mailing list