diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-11-17 19:16:36 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-11-17 19:16:36 +0000 |
commit | 6164753e81c574589822b246b89099dbe9439710 (patch) | |
tree | caa6812d46f1d7b3ba17473675535e5664951e9f /clang/lib/Driver/Driver.cpp | |
parent | e30f11d9ee08309d545224091bad706b9a8d4eca (diff) | |
download | bcm5719-llvm-6164753e81c574589822b246b89099dbe9439710.tar.gz bcm5719-llvm-6164753e81c574589822b246b89099dbe9439710.zip |
clang-cl: Allow /Fo without an argument (PR21589)
When it's used without an argument, the default file name is
used. The same goes for /Fe.
Also, allow using /Fo, /Fa and /Fe with multiple inputs if they
don't have an argument.
llvm-svn: 222164
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 1794e8e7070..5d25ed77b98 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1165,11 +1165,8 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args, // Diagnose misuse of /Fo. if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fo)) { StringRef V = A->getValue(); - if (V.empty()) { - // It has to have a value. - Diag(clang::diag::err_drv_missing_argument) << A->getSpelling() << 1; - Args.eraseArg(options::OPT__SLASH_Fo); - } else if (Inputs.size() > 1 && !llvm::sys::path::is_separator(V.back())) { + if (Inputs.size() > 1 && !V.empty() && + !llvm::sys::path::is_separator(V.back())) { // Check whether /Fo tries to name an output file for multiple inputs. Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources) << A->getSpelling() << V; @@ -1180,7 +1177,8 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args, // Diagnose misuse of /Fa. if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fa)) { StringRef V = A->getValue(); - if (Inputs.size() > 1 && !llvm::sys::path::is_separator(V.back())) { + if (Inputs.size() > 1 && !V.empty() && + !llvm::sys::path::is_separator(V.back())) { // Check whether /Fa tries to name an asm file for multiple inputs. Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources) << A->getSpelling() << V; @@ -1188,15 +1186,6 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args, } } - // Diagnose misuse of /Fe. - if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fe)) { - if (A->getValue()[0] == '\0') { - // It has to have a value. - Diag(clang::diag::err_drv_missing_argument) << A->getSpelling() << 1; - Args.eraseArg(options::OPT__SLASH_Fe); - } - } - // Diagnose misuse of /o. if (Arg *A = Args.getLastArg(options::OPT__SLASH_o)) { if (A->getValue()[0] == '\0') { |