[PATCH] D22091: [clang-rename] exit code-related bugfix and code cleanup

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 9 13:15:52 PDT 2016


alexfh added inline comments.

================
Comment at: clang-rename/USRLocFinder.cpp:63
@@ -62,3 +62,3 @@
     const ASTContext &Context = ConstructorDecl->getASTContext();
-    for (clang::CXXConstructorDecl::init_const_iterator it = ConstructorDecl->init_begin(); it != ConstructorDecl->init_end(); ++it) {
-      const clang::CXXCtorInitializer* Initializer = *it;
+    for (clang::CXXConstructorDecl::init_const_iterator it =
+             ConstructorDecl->init_begin();
----------------
This would look better as a range-based for loop.

================
Comment at: clang-rename/USRLocFinder.cpp:76
@@ -73,2 +75,3 @@
           SourceLocation Location = Initializer->getSourceLocation();
-          StringRef TokenName = Lexer::getSourceText(CharSourceRange::getTokenRange(Location), Context.getSourceManager(), Context.getLangOpts());
+          StringRef TokenName = Lexer::getSourceText(
+              CharSourceRange::getTokenRange(Location),
----------------
clang::tooling:fixit::getText may be a good alternative here.


http://reviews.llvm.org/D22091





More information about the cfe-commits mailing list