Better handing of stdin/stdout for -emit-llvm-bc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45345 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Christopher Lamb 2007-12-24 20:56:07 +00:00
Родитель 2d6c065fa9
Коммит 8bd848f1e8
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -644,14 +644,14 @@ ASTConsumer *clang::CreateBCWriter(const std::string& InFile,
std::string FileName = OutputFile; std::string FileName = OutputFile;
std::ostream *Out; std::ostream *Out;
if (!OutputFile.size()) { if (OutputFile == "-" || InFile == "-")
Out = llvm::cout.stream();
else if (!OutputFile.size()) {
llvm::sys::Path Path(InFile); llvm::sys::Path Path(InFile);
Path.eraseSuffix(); Path.eraseSuffix();
Path.appendSuffix("bc"); Path.appendSuffix("bc");
FileName = Path.toString(); FileName = Path.toString();
Out = new std::ofstream(FileName.c_str()); Out = new std::ofstream(FileName.c_str());
} else if (OutputFile == "-") {
Out = llvm::cout.stream();
} else { } else {
Out = new std::ofstream(FileName.c_str()); Out = new std::ofstream(FileName.c_str());
} }