diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-09-26 04:48:22 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-09-26 04:48:22 +0000 |
commit | 7df0fd1b25469e7c5574479d1ee949dd84f54e1c (patch) | |
tree | f39e260993116ae26bb1627895aeb2a767ec9945 /lib/Driver | |
parent | 1dd6f1e3832bcca23ea98bd89f68d8bebe7aa809 (diff) | |
download | clang-7df0fd1b25469e7c5574479d1ee949dd84f54e1c.tar.gz |
Driver: avoid failing in the backend
Avoid failing in the backend when the rewrite map does not exist. Rather check
that the map exists in the frontend before handing it off to the backend. Add
the missing rewrite maps that the tests were referencing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver')
-rw-r--r-- | lib/Driver/Tools.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7d1e0d091a..dcdc92a130 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -4213,9 +4213,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.hasArg(options::OPT_frewrite_map_file_EQ)) { for (const Arg *A : Args.filtered(options::OPT_frewrite_map_file, options::OPT_frewrite_map_file_EQ)) { - CmdArgs.push_back("-frewrite-map-file"); - CmdArgs.push_back(A->getValue()); - A->claim(); + StringRef Map = A->getValue(); + if (!llvm::sys::fs::exists(Map)) { + D.Diag(diag::err_drv_no_such_file) << Map; + } else { + CmdArgs.push_back("-frewrite-map-file"); + CmdArgs.push_back(A->getValue()); + A->claim(); + } } } |