[PATCH] D13759: [Clang] Fix Clang-tidy modernize-use-auto warnings in headers and generated files; other minor cleanups.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 05:21:32 PST 2015


aaron.ballman added inline comments.

================
Comment at: include/clang/Analysis/Analyses/Consumed.h:266
@@ -266,2 +265,3 @@
   };
-}} // end namespace clang::consumed
+} // end namespace consumed
+} // end namespace clang
----------------
I don't know whether this is an improvement or not.

================
Comment at: include/clang/Rewrite/Core/Rewriter.h:171
@@ -170,4 +170,3 @@
   const RewriteBuffer *getRewriteBufferFor(FileID FID) const {
-    std::map<FileID, RewriteBuffer>::const_iterator I =
-      RewriteBuffers.find(FID);
+    const auto I = RewriteBuffers.find(FID);
     return I == RewriteBuffers.end() ? nullptr : &I->second;
----------------
Not that this matters in the cases in this code, but const iterator is not the same as const_iterator. I think these changes are a step forward in terms of readability, but a step backwards in terms of the type system.

================
Comment at: tools/libclang/Indexing.cpp:672
@@ -671,5 +671,3 @@
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-    return false;
-  return true;
+  return (!IdxCtx.shouldAbort());
 }
----------------
The extra parens do not add any value here.

================
Comment at: utils/TableGen/ClangAttrEmitter.cpp:959
@@ -958,3 +958,3 @@
     void writeTemplateInstantiation(raw_ostream &OS) const override {
-      OS << "      " << getType() << " *tempInst" << getUpperName()
+      OS << "      auto *tempInst" << getUpperName()
          << " = new (C, 16) " << getType()
----------------
I really like all of these changes to this file!


Repository:
  rL LLVM

http://reviews.llvm.org/D13759





More information about the cfe-commits mailing list