mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-06 21:27:23 +00:00
Make 'opt -o -' work correctly instead of creating a file named './-'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -44,7 +44,7 @@ InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
|||||||
|
|
||||||
static cl::opt<std::string>
|
static cl::opt<std::string>
|
||||||
OutputFilename("o", cl::desc("Override output filename"),
|
OutputFilename("o", cl::desc("Override output filename"),
|
||||||
cl::value_desc("filename"));
|
cl::value_desc("filename"), cl::init("-"));
|
||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
Force("f", cl::desc("Overwrite output files"));
|
Force("f", cl::desc("Overwrite output files"));
|
||||||
@@ -93,7 +93,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Figure out what stream we are supposed to write to...
|
// Figure out what stream we are supposed to write to...
|
||||||
std::ostream *Out = &std::cout; // Default to printing to stdout...
|
std::ostream *Out = &std::cout; // Default to printing to stdout...
|
||||||
if (OutputFilename != "") {
|
if (OutputFilename != "-") {
|
||||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||||
// If force is not specified, make sure not to overwrite a file!
|
// If force is not specified, make sure not to overwrite a file!
|
||||||
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||||
|
Reference in New Issue
Block a user