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
This commit is contained in:
Saleem Abdulrasool 2016-09-26 04:48:22 +00:00
parent 1dd6f1e383
commit 7df0fd1b25
5 changed files with 10 additions and 3 deletions

View File

@ -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();
}
}
}

View File

View File

View File

View File

@ -0,0 +1,2 @@
// RUN: %clang -### -frewrite-map-file %t.map -c %s -o /dev/null 2>&1 | FileCheck %s
// CHECK: error: no such file or directory: