diff options
author | Martin Storsjo <martin@martin.st> | 2018-05-02 21:15:24 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2018-05-02 21:15:24 +0000 |
commit | e3b437935f3dfd2410871d067c38221f0d02e904 (patch) | |
tree | df266b695c715a33d54b8f8e61baf2c208d76e9a /llvm/tools/llvm-rc/llvm-rc.cpp | |
parent | ca169789676a755bd494ec23972f51b4c5a5a914 (diff) | |
download | bcm5719-llvm-e3b437935f3dfd2410871d067c38221f0d02e904.tar.gz bcm5719-llvm-e3b437935f3dfd2410871d067c38221f0d02e904.zip |
[llvm-rc] Default to writing the output next to the input, if no output is specified
This matches what rc.exe does if no output is specified.
Differential Revision: https://reviews.llvm.org/D46239
llvm-svn: 331403
Diffstat (limited to 'llvm/tools/llvm-rc/llvm-rc.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/llvm-rc.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp index 1f0f16f1685..6495052e8ab 100644 --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -24,6 +24,7 @@ #include "llvm/Support/InitLLVM.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" @@ -157,9 +158,15 @@ int main(int Argc, const char **Argv) { if (!IsDryRun) { auto OutArgsInfo = InputArgs.getAllArgValues(OPT_FILEOUT); + if (OutArgsInfo.empty()) { + SmallString<128> OutputFile = InputFile; + llvm::sys::path::replace_extension(OutputFile, "res"); + OutArgsInfo.push_back(OutputFile.str()); + } + if (OutArgsInfo.size() != 1) fatalError( - "Exactly one output file should be provided (using /FO flag)."); + "No more than one output file should be provided (using /FO flag)."); std::error_code EC; auto FOut = |