Пример #1
0
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
std::ostream *
llvm::GetLibSupportInfoOutputFile() {
  std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
  if (LibSupportInfoOutputFilename.empty())
    return cerr.stream();
  if (LibSupportInfoOutputFilename == "-")
    return cout.stream();

  std::ostream *Result = new std::ofstream(LibSupportInfoOutputFilename.c_str(),
                                           std::ios::app);
  if (!Result->good()) {
    cerr << "Error opening info-output-file '"
         << LibSupportInfoOutputFilename << " for appending!\n";
    delete Result;
    return cerr.stream();
  }
  return Result;
}
Пример #2
0
// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
raw_ostream *
llvm::GetLibSupportInfoOutputFile() {
    std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
    if (LibSupportInfoOutputFilename.empty())
        return &errs();
    if (LibSupportInfoOutputFilename == "-")
        return &outs();


    std::string Error;
    raw_ostream *Result = new raw_fd_ostream(LibSupportInfoOutputFilename.c_str(),
            Error, raw_fd_ostream::F_Append);
    if (Error.empty())
        return Result;

    errs() << "Error opening info-output-file '"
           << LibSupportInfoOutputFilename << " for appending!\n";
    delete Result;
    return &errs();
}