[clang-tools-extra] r284155 - [clang-move] error out when fail to create new files.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 12:49:19 PDT 2016


Author: ioeric
Date: Thu Oct 13 14:49:19 2016
New Revision: 284155

URL: http://llvm.org/viewvc/llvm-project?rev=284155&view=rev
Log:
[clang-move] error out when fail to create new files.

Modified:
    clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp

Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=284155&r1=284154&r2=284155&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Thu Oct 13 14:49:19 2016
@@ -108,10 +108,22 @@ int main(int argc, const char **argv) {
   if (CodeStatus)
     return CodeStatus;
 
-  if (!NewCC.empty())
-    CreateNewFile(NewCC);
-  if (!NewHeader.empty())
-    CreateNewFile(NewHeader);
+  if (!NewCC.empty()) {
+    std::error_code EC = CreateNewFile(NewCC);
+    if (EC) {
+      llvm::errs() << "Failed to create " << NewCC << ": " << EC.message()
+                   << "\n";
+      return EC.value();
+    }
+  }
+  if (!NewHeader.empty()) {
+    std::error_code EC = CreateNewFile(NewHeader);
+    if (EC) {
+      llvm::errs() << "Failed to create " << NewHeader << ": " << EC.message()
+                   << "\n";
+      return EC.value();
+    }
+  }
 
   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
   clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);




More information about the cfe-commits mailing list