[PATCH] D15388: [Clang] Use autos in lib/AST/Expr.cpp
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 10 11:18:14 PST 2015
aaron.ballman added inline comments.
================
Comment at: lib/AST/Expr.cpp:67
@@ -65,3 +66,3 @@
E = CE->getSubExpr();
- CXXRecordDecl *Derived
+ auto *Derived
= cast<CXXRecordDecl>(E->getType()->getAs<RecordType>()->getDecl());
----------------
Again, I don't think it is an improvement when the deduced type is on a different line (here and elsewhere).
================
Comment at: lib/AST/Expr.cpp:1956
@@ -1967,1 +1955,3 @@
+ for (const auto &I : InitExprs) {
+ if (Stmt *S = I) {
Beg = S->getLocStart();
----------------
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.
================
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));
----------------
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).
Repository:
rL LLVM
http://reviews.llvm.org/D15388
More information about the cfe-commits
mailing list