[PATCH] D15338: [Clang] Use autos in lib/AST/ASTContext.cpp
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 8 11:04:02 PST 2015
aaron.ballman added inline comments.
================
Comment at: lib/AST/ASTContext.cpp:299
@@ -299,3 +298,3 @@
// specialization?
- if (const ClassTemplateSpecializationDecl *CTSD =
+ if (const auto *CTSD =
dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
----------------
Can this now fit onto one line? If not, I don't think this is an improvement.
================
Comment at: lib/AST/ASTContext.cpp:2478
@@ -2485,4 +2477,3 @@
- LValueReferenceType *New
- = new (*this, TypeAlignment) LValueReferenceType(T, Canonical,
- SpelledAsLValue);
+ auto *New = new (*this, TypeAlignment)
+ LValueReferenceType(T, Canonical, SpelledAsLValue);
----------------
I'm not convinced this one is better than the previous incarnation due to the type being on a separate line.
================
Comment at: lib/AST/ASTContext.cpp:2772
@@ -2782,6 +2771,3 @@
if (!numElements) {
- DependentSizedArrayType *newType
- = new (*this, TypeAlignment)
- DependentSizedArrayType(*this, elementType, QualType(),
- numElements, ASM, elementTypeQuals,
- brackets);
+ auto *newType = new (*this, TypeAlignment)
+ DependentSizedArrayType(*this, elementType, QualType(), numElements, ASM,
----------------
Same here.
================
Comment at: lib/AST/ASTContext.cpp:2816
@@ -2828,5 +2815,3 @@
// of the element type.
- DependentSizedArrayType *sugaredType
- = new (*this, TypeAlignment)
- DependentSizedArrayType(*this, elementType, canon, numElements,
- ASM, elementTypeQuals, brackets);
+ auto *sugaredType = new (*this, TypeAlignment)
+ DependentSizedArrayType(*this, elementType, canon, numElements, ASM,
----------------
And here as well. (I'll stop commenting on these unless I have something new to add.)
================
Comment at: lib/AST/ASTContext.cpp:3270
@@ -3284,3 +3269,3 @@
- SubstTemplateTypeParmPackType *SubstParm
+ auto *SubstParm
= new (*this, TypeAlignment) SubstTemplateTypeParmPackType(Parm, Canon,
----------------
Here as well, but with stronger feelings due to there being no indication of initialization until the next line. This applies elsewhere in this patch as well.
Repository:
rL LLVM
http://reviews.llvm.org/D15338
More information about the cfe-commits
mailing list