[PATCH] D13759: [Clang] Fix Clang-tidy modernize-use-auto warnings in headers and generated files; other minor cleanups.
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 10 00:48:43 PST 2015
hans added a comment.
Some of these are great improvements, especially using auto for iterators etc.
But I'm not sure we'll want to start changing "Foo *foo = new Foo;" to use auto everywhere. I expect we'd have to do that in a huge number of places?
================
Comment at: include/clang/AST/ASTVector.h:385
@@ -383,3 +384,3 @@
// Allocate the memory from the ASTContext.
- T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
+ auto *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
----------------
I'm not sure this one is an improvement.
================
Comment at: include/clang/AST/DeclContextInternals.h:90
@@ -88,3 +89,3 @@
else {
- DeclsTy *VT = new DeclsTy();
+ auto *VT = new DeclsTy();
if (NamedDecl *OldD = getAsDecl())
----------------
Same here.
================
Comment at: include/clang/AST/DeclTemplate.h:1726
@@ -1725,4 +1725,3 @@
"Already set to a class template partial specialization!");
- SpecializedPartialSpecialization *PS
- = new (getASTContext()) SpecializedPartialSpecialization();
+ auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
PS->PartialSpecialization = PartialSpec;
----------------
But here it does make it nicer :-)
Repository:
rL LLVM
http://reviews.llvm.org/D13759
More information about the cfe-commits
mailing list