[PATCH] D22654: [Clang-rename] Remove custom version, fix extra space in error message

Eugene Zelenko via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 15:29:34 PDT 2016


Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: omtcyfz, vmiklos, klimek.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

I also fixed some Include What You Use Warnings.

Repository:
  rL LLVM

https://reviews.llvm.org/D22654

Files:
  clang-rename/tool/ClangRename.cpp
  test/clang-rename/InvalidNewName.cpp

Index: test/clang-rename/InvalidNewName.cpp
===================================================================
--- test/clang-rename/InvalidNewName.cpp
+++ test/clang-rename/InvalidNewName.cpp
@@ -1,2 +1,2 @@
 // RUN: not clang-rename -new-name=class -offset=133 %s 2>&1 | FileCheck %s
-// CHECK: ERROR: new name is not a valid identifier in  C++17.
+// CHECK: ERROR: new name is not a valid identifier in C++17.
Index: clang-rename/tool/ClangRename.cpp
===================================================================
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -15,28 +15,28 @@
 
 #include "../USRFindingAction.h"
 #include "../RenamingAction.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/AST/ASTContext.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticIDs.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/TargetInfo.h"
-#include "clang/Basic/TargetOptions.h"
-#include "clang/Frontend/CommandLineSourceLoc.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Frontend/FrontendAction.h"
+#include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TokenKinds.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
-#include "clang/Lex/Lexer.h"
-#include "clang/Lex/Preprocessor.h"
-#include "clang/Parse/ParseAST.h"
-#include "clang/Parse/Parser.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/ReplacementsYaml.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Host.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/YAMLTraits.h"
+#include <cstdlib>
 #include <string>
+#include <system_error>
 
 using namespace llvm;
 
@@ -79,12 +79,6 @@
     cl::value_desc("filename"),
     cl::cat(ClangRenameCategory));
 
-#define CLANG_RENAME_VERSION "0.0.1"
-
-static void PrintVersion() {
-  outs() << "clang-rename version " << CLANG_RENAME_VERSION << '\n';
-}
-
 using namespace clang;
 
 const char RenameUsage[] = "A tool to rename symbols in C/C++ code.\n\
@@ -93,7 +87,6 @@
 Otherwise, the results are written to stdout.\n";
 
 int main(int argc, const char **argv) {
-  cl::SetVersionPrinter(PrintVersion);
   tooling::CommonOptionsParser OP(argc, argv, ClangRenameCategory, RenameUsage);
 
   // Check the arguments for correctness.
@@ -110,7 +103,7 @@
   IdentifierTable Table(Options);
   auto NewNameTokKind = Table.get(NewName).getTokenID();
   if (!tok::isAnyIdentifier(NewNameTokKind)) {
-    errs() << "ERROR: new name is not a valid identifier in  C++17.\n\n";
+    errs() << "ERROR: new name is not a valid identifier in C++17.\n\n";
     exit(1);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22654.64977.patch
Type: text/x-patch
Size: 2950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160721/cc67f549/attachment.bin>


More information about the cfe-commits mailing list