summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-move/tool/ClangMoveMain.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-10-13 19:49:19 +0000
committerEric Liu <ioeric@google.com>2016-10-13 19:49:19 +0000
commit6ed762ce183220f0b97c6877995afce1a947efb7 (patch)
tree97b6aec19b619a79b295dc4c59a537e0b59da78f /clang-tools-extra/clang-move/tool/ClangMoveMain.cpp
parent887a82c5d633548c97d3e5f5b586bb88f5bb8943 (diff)
downloadbcm5719-llvm-6ed762ce183220f0b97c6877995afce1a947efb7.tar.gz
bcm5719-llvm-6ed762ce183220f0b97c6877995afce1a947efb7.zip
[clang-move] error out when fail to create new files.
llvm-svn: 284155
Diffstat (limited to 'clang-tools-extra/clang-move/tool/ClangMoveMain.cpp')
-rw-r--r--clang-tools-extra/clang-move/tool/ClangMoveMain.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-move/tool/ClangMoveMain.cpp b/clang-tools-extra/clang-move/tool/ClangMoveMain.cpp
index 3787e940b7f..c1ab13bd9a6 100644
--- a/clang-tools-extra/clang-move/tool/ClangMoveMain.cpp
+++ b/clang-tools-extra/clang-move/tool/ClangMoveMain.cpp
@@ -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);
OpenPOWER on IntegriCloud