[clang-tools-extra] r278201 - clang-rename YAML reader: address post-commit comments

Miklos Vajna via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 00:13:30 PDT 2016


Author: vmiklos
Date: Wed Aug 10 02:13:29 2016
New Revision: 278201

URL: http://llvm.org/viewvc/llvm-project?rev=278201&view=rev
Log:
clang-rename YAML reader: address post-commit comments

Modified:
    clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
    clang-tools-extra/trunk/docs/clang-rename.rst

Modified: clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp?rev=278201&r1=278200&r2=278201&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp Wed Aug 10 02:13:29 2016
@@ -59,10 +59,8 @@ static int helpMain(int argc, const char
 /// \brief An oldname -> newname rename.
 struct RenameAllInfo {
   std::string OldName;
-  unsigned Offset;
+  unsigned Offset = 0;
   std::string NewName;
-
-  RenameAllInfo() : Offset(0) {}
 };
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(RenameAllInfo)
@@ -70,7 +68,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(RenameAllIn
 namespace llvm {
 namespace yaml {
 
-/// \brief Specialized MappingTraits to describe how a RenameAllInfo is /
+/// \brief Specialized MappingTraits to describe how a RenameAllInfo is
 /// (de)serialized.
 template <> struct MappingTraits<RenameAllInfo> {
   static void mapping(IO &IO, RenameAllInfo &Info) {
@@ -149,11 +147,12 @@ int subcommandMain(bool isRenameAll, int
 
   if (!Input.empty()) {
     // Populate OldNames and NewNames from a YAML file.
-    auto Buffer = llvm::MemoryBuffer::getFile(Input);
+    ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
+        llvm::MemoryBuffer::getFile(Input);
     if (!Buffer) {
       errs() << "clang-rename: failed to read " << Input << ": "
              << Buffer.getError().message() << "\n";
-      exit(1);
+      return 1;
     }
 
     std::vector<RenameAllInfo> Infos;

Modified: clang-tools-extra/trunk/docs/clang-rename.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-rename.rst?rev=278201&r1=278200&r2=278201&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-rename.rst (original)
+++ clang-tools-extra/trunk/docs/clang-rename.rst Wed Aug 10 02:13:29 2016
@@ -42,7 +42,7 @@ To get an offset of a symbol in a file r
   $ grep -FUbo 'foo' file.cpp
 
 
-The tool currently supports renaming actions inside a single Translation Unit
+The tool currently supports renaming actions inside a single translation unit
 only. It is planned to extend the tool's functionality to support multi-TU
 renaming actions in the future.
 




More information about the cfe-commits mailing list