[PATCH] D15366: [Clang] Use autos in lib/AST/ASTImporter.cpp

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 10:59:06 PST 2015


aaron.ballman added inline comments.

================
Comment at: lib/AST/ASTImporter.cpp:1676
@@ -1690,3 +1675,3 @@
 QualType ASTNodeImporter::VisitTypedefType(const TypedefType *T) {
-  TypedefNameDecl *ToDecl
+  const auto *ToDecl
              = dyn_cast_or_null<TypedefNameDecl>(Importer.Import(T->getDecl()));
----------------
I don't think it is an improvement when the deduced type is written on the subsequent line (here and elsewhere). I wonder if that's something we can teach clang-format. e.g.,
```
const auto *ToDecl = dyn_cast_or_null<TypedefNameDecl>(
  Importer.Import(T->getDecl()));
```
would be an improvement, but only in the case where the declaration type needs to be deduced.

================
Comment at: lib/AST/ASTImporter.cpp:5855
@@ -5888,3 +5854,3 @@
   }
-  else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) {
+  else if (auto *PD = dyn_cast<ObjCProtocolDecl>(D)) {
     if (!PD->getDefinition())
----------------
Can you fix the formatting here while you're at it? (Same below.)


Repository:
  rL LLVM

http://reviews.llvm.org/D15366





More information about the cfe-commits mailing list