1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC

F_{None,Text,Append} are kept for compatibility since r334221.

llvm-svn: 367800
This commit is contained in:
Fangrui Song 2019-08-05 05:43:48 +00:00
parent 4b41f5003e
commit 6b986b0b9e
69 changed files with 105 additions and 104 deletions

View File

@ -144,7 +144,7 @@ our file to:
auto Filename = "output.o";
std::error_code EC;
raw_fd_ostream dest(Filename, EC, sys::fs::F_None);
raw_fd_ostream dest(Filename, EC, sys::fs::OF_None);
if (EC) {
errs() << "Could not open file: " << EC.message();

View File

@ -126,7 +126,7 @@ int main(int argc, char **argv) {
}
if (OutputFilename != "-") {
std::error_code EC;
out = new raw_fd_ostream(OutputFilename, EC, sys::fs::F_None);
out = new raw_fd_ostream(OutputFilename, EC, sys::fs::OF_None);
}
}

View File

@ -1245,7 +1245,7 @@ int main() {
auto Filename = "output.o";
std::error_code EC;
raw_fd_ostream dest(Filename, EC, sys::fs::F_None);
raw_fd_ostream dest(Filename, EC, sys::fs::OF_None);
if (EC) {
errs() << "Could not open file: " << EC.message();

View File

@ -99,7 +99,7 @@ public:
errs() << "Writing '" << Filename << "'...";
raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
raw_fd_ostream File(Filename, EC, sys::fs::OF_Text);
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
std::string Title = GraphName + " for '" + F.getName().str() + "' function";
@ -162,7 +162,7 @@ public:
errs() << "Writing '" << Filename << "'...";
raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
raw_fd_ostream File(Filename, EC, sys::fs::OF_Text);
std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
if (!EC)

View File

@ -99,7 +99,7 @@ static void writeCFGToDotFile(Function &F, bool CFGOnly = false) {
errs() << "Writing '" << Filename << "'...";
std::error_code EC;
raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
raw_fd_ostream File(Filename, EC, sys::fs::OF_Text);
if (!EC)
WriteGraph(File, (const Function*)&F, CFGOnly);

View File

@ -813,7 +813,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
if (!ModuleSummaryDotFile.empty()) {
std::error_code EC;
raw_fd_ostream OSDot(ModuleSummaryDotFile, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OSDot(ModuleSummaryDotFile, EC, sys::fs::OpenFlags::OF_None);
if (EC)
report_fatal_error(Twine("Failed to open dot file ") +
ModuleSummaryDotFile + ": " + EC.message() + "\n");

View File

@ -19,7 +19,7 @@ using namespace llvm;
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
std::error_code EC;
raw_fd_ostream OS(Path, EC, sys::fs::F_None);
raw_fd_ostream OS(Path, EC, sys::fs::OF_None);
if (EC)
return -1;

View File

@ -848,7 +848,7 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) {
std::string GraphFileName = FullyQualifiedName + "." + RS.str() +
".pbqpgraph";
std::error_code EC;
raw_fd_ostream OS(GraphFileName, EC, sys::fs::F_Text);
raw_fd_ostream OS(GraphFileName, EC, sys::fs::OF_Text);
LLVM_DEBUG(dbgs() << "Dumping graph for round " << Round << " to \""
<< GraphFileName << "\"\n");
G.dump(OS);

View File

@ -386,7 +386,7 @@ void LLVMDumpModule(LLVMModuleRef M) {
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
char **ErrorMessage) {
std::error_code EC;
raw_fd_ostream dest(Filename, EC, sys::fs::F_Text);
raw_fd_ostream dest(Filename, EC, sys::fs::OF_Text);
if (EC) {
*ErrorMessage = strdup(EC.message().c_str());
return true;

View File

@ -126,7 +126,7 @@ llvm::setupOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
std::error_code EC;
auto RemarksFile =
llvm::make_unique<ToolOutputFile>(RemarksFilename, EC, sys::fs::F_None);
llvm::make_unique<ToolOutputFile>(RemarksFilename, EC, sys::fs::OF_None);
// We don't use llvm::FileError here because some diagnostics want the file
// name separately.
if (EC)

View File

@ -1205,7 +1205,7 @@ public:
std::error_code EC;
raw_fd_ostream OS(NewModulePath + ".thinlto.bc", EC,
sys::fs::OpenFlags::F_None);
sys::fs::OpenFlags::OF_None);
if (EC)
return errorCodeToError(EC);
WriteIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex);
@ -1382,7 +1382,7 @@ lto::setupStatsFile(StringRef StatsFilename) {
llvm::EnableStatistics(false);
std::error_code EC;
auto StatsFile =
llvm::make_unique<ToolOutputFile>(StatsFilename, EC, sys::fs::F_None);
llvm::make_unique<ToolOutputFile>(StatsFilename, EC, sys::fs::OF_None);
if (EC)
return errorCodeToError(EC);

View File

@ -58,7 +58,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
std::error_code EC;
ResolutionFile = llvm::make_unique<raw_fd_ostream>(
OutputFileName + "resolution.txt", EC, sys::fs::OpenFlags::F_Text);
OutputFileName + "resolution.txt", EC, sys::fs::OpenFlags::OF_Text);
if (EC)
return errorCodeToError(EC);
@ -83,7 +83,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
PathPrefix = M.getModuleIdentifier() + ".";
std::string Path = PathPrefix + PathSuffix + ".bc";
std::error_code EC;
raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::OF_None);
// Because -save-temps is a debugging feature, we report the error
// directly and exit.
if (EC)
@ -103,7 +103,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
CombinedIndexHook = [=](const ModuleSummaryIndex &Index) {
std::string Path = OutputFileName + "index.bc";
std::error_code EC;
raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(Path, EC, sys::fs::OpenFlags::OF_None);
// Because -save-temps is a debugging feature, we report the error
// directly and exit.
if (EC)
@ -111,7 +111,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
WriteIndexToFile(Index, OS);
Path = OutputFileName + "index.dot";
raw_fd_ostream OSDot(Path, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OSDot(Path, EC, sys::fs::OpenFlags::OF_None);
if (EC)
reportOpenError(Path, EC.message());
Index.exportToDot(OSDot);
@ -329,7 +329,7 @@ void codegen(Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
if (!DwoFile.empty()) {
std::error_code EC;
DwoOut = llvm::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::F_None);
DwoOut = llvm::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::OF_None);
if (EC)
report_fatal_error("Failed to open " + DwoFile + ": " + EC.message());
}

View File

@ -229,7 +229,7 @@ bool LTOCodeGenerator::writeMergedModules(StringRef Path) {
// create output file
std::error_code EC;
ToolOutputFile Out(Path, EC, sys::fs::F_None);
ToolOutputFile Out(Path, EC, sys::fs::OF_None);
if (EC) {
std::string ErrMsg = "could not open bitcode file for writing: ";
ErrMsg += Path.str() + ": " + EC.message();

View File

@ -89,7 +89,7 @@ static void saveTempBitcode(const Module &TheModule, StringRef TempDir,
// User asked to save temps, let dump the bitcode file after import.
std::string SaveTempPath = (TempDir + llvm::Twine(count) + Suffix).str();
std::error_code EC;
raw_fd_ostream OS(SaveTempPath, EC, sys::fs::F_None);
raw_fd_ostream OS(SaveTempPath, EC, sys::fs::OF_None);
if (EC)
report_fatal_error(Twine("Failed to open ") + SaveTempPath +
" to save optimized bitcode\n");
@ -845,7 +845,7 @@ ThinLTOCodeGenerator::writeGeneratedObject(int count, StringRef CacheEntryPath,
}
// No cache entry, just write out the buffer.
std::error_code Err;
raw_fd_ostream OS(OutputPath, Err, sys::fs::F_None);
raw_fd_ostream OS(OutputPath, Err, sys::fs::OF_None);
if (Err)
report_fatal_error("Can't open output '" + OutputPath + "'\n");
OS << OutputBuffer.getBuffer();
@ -900,7 +900,7 @@ void ThinLTOCodeGenerator::run() {
if (!SaveTempsDir.empty()) {
auto SaveTempPath = SaveTempsDir + "index.bc";
std::error_code EC;
raw_fd_ostream OS(SaveTempPath, EC, sys::fs::F_None);
raw_fd_ostream OS(SaveTempPath, EC, sys::fs::OF_None);
if (EC)
report_fatal_error(Twine("Failed to open ") + SaveTempPath +
" to save optimized bitcode\n");

View File

@ -779,7 +779,7 @@ bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
if (!OS) {
std::error_code EC;
auto NewOS = llvm::make_unique<raw_fd_ostream>(
StringRef(SecureLogFile), EC, sys::fs::F_Append | sys::fs::F_Text);
StringRef(SecureLogFile), EC, sys::fs::OF_Append | sys::fs::OF_Text);
if (EC)
return Error(IDLoc, Twine("can't open secure log file: ") +
SecureLogFile + " (" + EC.message() + ")");

View File

@ -706,7 +706,7 @@ FileInfo::openCoveragePath(StringRef CoveragePath) {
std::error_code EC;
auto OS =
llvm::make_unique<raw_fd_ostream>(CoveragePath, EC, sys::fs::F_Text);
llvm::make_unique<raw_fd_ostream>(CoveragePath, EC, sys::fs::OF_Text);
if (EC) {
errs() << EC.message() << "\n";
return llvm::make_unique<raw_null_ostream>();

View File

@ -350,9 +350,9 @@ SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
std::error_code EC;
std::unique_ptr<raw_ostream> OS;
if (Format == SPF_Binary || Format == SPF_Compact_Binary)
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_None));
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_None));
else
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_Text));
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_Text));
if (EC)
return EC;

View File

@ -45,7 +45,7 @@ struct FileInfo {
/// interval option.
static void writeTimestampFile(StringRef TimestampFile) {
std::error_code EC;
raw_fd_ostream Out(TimestampFile.str(), EC, sys::fs::F_None);
raw_fd_ostream Out(TimestampFile.str(), EC, sys::fs::OF_None);
}
static Expected<std::chrono::seconds> parseDuration(StringRef Duration) {

View File

@ -101,7 +101,7 @@ bool CodeGenCoverage::emit(StringRef CoveragePrefix,
std::string CoverageFilename = (CoveragePrefix + Pid).str();
std::error_code EC;
sys::fs::OpenFlags OpenFlags = sys::fs::F_Append;
sys::fs::OpenFlags OpenFlags = sys::fs::OF_Append;
std::unique_ptr<ToolOutputFile> CoverageFile =
llvm::make_unique<ToolOutputFile>(CoverageFilename, EC, OpenFlags);
if (EC)

View File

@ -179,7 +179,7 @@ std::error_code FileCollector::writeMapping(StringRef mapping_file) {
VFSWriter.setUseExternalNames(false);
std::error_code EC;
raw_fd_ostream os(mapping_file, EC, sys::fs::F_Text);
raw_fd_ostream os(mapping_file, EC, sys::fs::OF_Text);
if (EC)
return EC;

View File

@ -68,7 +68,7 @@ std::unique_ptr<raw_fd_ostream> llvm::CreateInfoOutputFile() {
// info output file before running commands which write to it.
std::error_code EC;
auto Result = llvm::make_unique<raw_fd_ostream>(
OutputFilename, EC, sys::fs::F_Append | sys::fs::F_Text);
OutputFilename, EC, sys::fs::OF_Append | sys::fs::OF_Text);
if (!EC)
return Result;

View File

@ -887,9 +887,9 @@ static int nativeOpenFlags(CreationDisposition Disp, OpenFlags Flags,
else if (Access == (FA_Read | FA_Write))
Result |= O_RDWR;
// This is for compatibility with old code that assumed F_Append implied
// This is for compatibility with old code that assumed OF_Append implied
// would open an existing file. See Windows/Path.inc for a longer comment.
if (Flags & F_Append)
if (Flags & OF_Append)
Disp = CD_OpenAlways;
if (Disp == CD_CreateNew) {
@ -904,7 +904,7 @@ static int nativeOpenFlags(CreationDisposition Disp, OpenFlags Flags,
// Nothing special, just don't add O_CREAT and we get these semantics.
}
if (Flags & F_Append)
if (Flags & OF_Append)
Result |= O_APPEND;
#ifdef O_CLOEXEC

View File

@ -444,7 +444,7 @@ std::error_code
llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents,
WindowsEncodingMethod Encoding /*unused*/) {
std::error_code EC;
llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OpenFlags::F_Text);
llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OpenFlags::OF_Text);
if (EC)
return EC;

View File

@ -470,7 +470,7 @@ std::error_code
llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents,
WindowsEncodingMethod Encoding) {
std::error_code EC;
llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::F_Text);
llvm::raw_fd_ostream OS(FileName, EC, llvm::sys::fs::OF_Text);
if (EC)
return EC;

View File

@ -843,7 +843,7 @@ void raw_fd_ostream::anchor() {}
raw_ostream &llvm::outs() {
// Set buffer settings to model stdout behavior.
std::error_code EC;
static raw_fd_ostream S("-", EC, sys::fs::F_None);
static raw_fd_ostream S("-", EC, sys::fs::OF_None);
assert(!EC);
return S;
}

View File

@ -64,7 +64,7 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) {
return reportError(argv0, "the option -d must be used together with -o\n");
std::error_code EC;
ToolOutputFile DepOut(DependFilename, EC, sys::fs::F_Text);
ToolOutputFile DepOut(DependFilename, EC, sys::fs::OF_Text);
if (EC)
return reportError(argv0, "error opening " + DependFilename + ":" +
EC.message() + "\n");
@ -122,7 +122,7 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *MainFn) {
return 0;
std::error_code EC;
ToolOutputFile OutFile(OutputFilename, EC, sys::fs::F_Text);
ToolOutputFile OutFile(OutputFilename, EC, sys::fs::OF_Text);
if (EC)
return reportError(argv0, "error opening " + OutputFilename + ":" +
EC.message() + "\n");

View File

@ -219,7 +219,7 @@ static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
char* Filename, LLVMCodeGenFileType codegen, char** ErrorMessage) {
std::error_code EC;
raw_fd_ostream dest(Filename, EC, sys::fs::F_None);
raw_fd_ostream dest(Filename, EC, sys::fs::OF_None);
if (EC) {
*ErrorMessage = strdup(EC.message().c_str());
return true;

View File

@ -892,7 +892,7 @@ std::error_code llvm::EmitImportsFiles(
StringRef ModulePath, StringRef OutputFilename,
const std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex) {
std::error_code EC;
raw_fd_ostream ImportsOS(OutputFilename, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream ImportsOS(OutputFilename, EC, sys::fs::OpenFlags::OF_None);
if (EC)
return EC;
for (auto &ILI : ModuleToSummariesForIndex)

View File

@ -1630,7 +1630,7 @@ bool LowerTypeTestsModule::runForTesting(Module &M) {
ExitOnError ExitOnErr("-lowertypetests-write-summary: " + ClWriteSummary +
": ");
std::error_code EC;
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::F_Text);
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_Text);
ExitOnErr(errorCodeToError(EC));
yaml::Output Out(OS);

View File

@ -771,7 +771,7 @@ bool DevirtModule::runForTesting(
ExitOnError ExitOnErr(
"-wholeprogramdevirt-write-summary: " + ClWriteSummary + ": ");
std::error_code EC;
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::F_Text);
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_Text);
ExitOnErr(errorCodeToError(EC));
yaml::Output Out(OS);

View File

@ -669,7 +669,8 @@ void GCOVProfiler::emitProfileNotes() {
continue;
std::error_code EC;
raw_fd_ostream out(mangleName(CU, GCovFileType::GCNO), EC, sys::fs::F_None);
raw_fd_ostream out(mangleName(CU, GCovFileType::GCNO), EC,
sys::fs::OF_None);
if (EC) {
Ctx->emitError(Twine("failed to open coverage notes file for writing: ") +
EC.message());

View File

@ -100,7 +100,8 @@ public:
if (!ClOrderFileWriteMapping.empty()) {
std::lock_guard<std::mutex> LogLock(MappingMutex);
std::error_code EC;
llvm::raw_fd_ostream OS(ClOrderFileWriteMapping, EC, llvm::sys::fs::F_Append);
llvm::raw_fd_ostream OS(ClOrderFileWriteMapping, EC,
llvm::sys::fs::OF_Append);
if (EC) {
report_fatal_error(Twine("Failed to open ") + ClOrderFileWriteMapping +
" to save mapping file for order file instrumentation\n");

View File

@ -79,7 +79,7 @@ bool BugDriver::writeProgramToFile(int FD, const Module &M) const {
bool BugDriver::writeProgramToFile(const std::string &Filename,
const Module &M) const {
std::error_code EC;
ToolOutputFile Out(Filename, EC, sys::fs::F_None);
ToolOutputFile Out(Filename, EC, sys::fs::OF_None);
if (!EC)
return writeProgramToFileAux(Out, M);
return true;

View File

@ -178,7 +178,7 @@ static Error createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) {
llvm::SmallString<128> InfoPlist(BundleRoot);
llvm::sys::path::append(InfoPlist, "Contents/Info.plist");
std::error_code EC;
llvm::raw_fd_ostream PL(InfoPlist, EC, llvm::sys::fs::F_Text);
llvm::raw_fd_ostream PL(InfoPlist, EC, llvm::sys::fs::OF_Text);
if (EC)
return make_error<StringError>(
"cannot create Plist: " + toString(errorCodeToError(EC)), EC);
@ -584,7 +584,7 @@ int main(int argc, char **argv) {
} else {
std::error_code EC;
OS = std::make_shared<raw_fd_ostream>(NoOutput ? "-" : OutputFile, EC,
sys::fs::F_None);
sys::fs::OF_None);
if (EC) {
WithColor::error() << OutputFile << ": " << EC.message();
return 1;

View File

@ -886,7 +886,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,
case options::OT_BC_ONLY:
Conf.PostInternalizeModuleHook = [](size_t Task, const Module &M) {
std::error_code EC;
raw_fd_ostream OS(output_name, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(output_name, EC, sys::fs::OpenFlags::OF_None);
if (EC)
message(LDPL_FATAL, "Failed to write the output file.");
WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ false);
@ -947,7 +947,7 @@ static void writeEmptyDistributedBuildOutputs(const std::string &ModulePath,
std::error_code EC;
{
raw_fd_ostream OS(NewModulePath + ".thinlto.bc", EC,
sys::fs::OpenFlags::F_None);
sys::fs::OpenFlags::OF_None);
if (EC)
message(LDPL_FATAL, "Failed to write '%s': %s",
(NewModulePath + ".thinlto.bc").c_str(), EC.message().c_str());
@ -960,7 +960,7 @@ static void writeEmptyDistributedBuildOutputs(const std::string &ModulePath,
}
if (options::thinlto_emit_imports_files) {
raw_fd_ostream OS(NewModulePath + ".imports", EC,
sys::fs::OpenFlags::F_None);
sys::fs::OpenFlags::OF_None);
if (EC)
message(LDPL_FATAL, "Failed to write '%s': %s",
(NewModulePath + ".imports").c_str(), EC.message().c_str());
@ -975,7 +975,7 @@ static std::unique_ptr<raw_fd_ostream> CreateLinkedObjectsFile() {
assert(options::thinlto_index_only);
std::error_code EC;
auto LinkedObjectsFile = llvm::make_unique<raw_fd_ostream>(
options::thinlto_linked_objects_file, EC, sys::fs::OpenFlags::F_None);
options::thinlto_linked_objects_file, EC, sys::fs::OpenFlags::OF_None);
if (EC)
message(LDPL_FATAL, "Failed to create '%s': %s",
options::thinlto_linked_objects_file.c_str(), EC.message().c_str());

View File

@ -239,9 +239,9 @@ static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
// Open the file.
std::error_code EC;
sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
sys::fs::OpenFlags OpenFlags = sys::fs::OF_None;
if (!Binary)
OpenFlags |= sys::fs::F_Text;
OpenFlags |= sys::fs::OF_Text;
auto FDOut = llvm::make_unique<ToolOutputFile>(OutputFilename, EC, OpenFlags);
if (EC) {
WithColor::error() << EC.message() << '\n';
@ -480,7 +480,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
if (!SplitDwarfOutputFile.empty()) {
std::error_code EC;
DwoOut = llvm::make_unique<ToolOutputFile>(SplitDwarfOutputFile, EC,
sys::fs::F_None);
sys::fs::OF_None);
if (EC) {
WithColor::error(errs(), argv[0]) << EC.message() << '\n';
return 1;

View File

@ -251,7 +251,7 @@ public:
sys::fs::create_directories(Twine(dir));
}
std::error_code EC;
raw_fd_ostream outfile(CacheName, EC, sys::fs::F_None);
raw_fd_ostream outfile(CacheName, EC, sys::fs::OF_None);
outfile.write(Obj.getBufferStart(), Obj.getBufferSize());
outfile.close();
}
@ -726,7 +726,7 @@ static std::function<void(Module &)> createDebugDumper() {
case DumpKind::DumpModsToDisk:
return [](Module &M) {
std::error_code EC;
raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC, sys::fs::F_Text);
raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC, sys::fs::OF_Text);
if (EC) {
errs() << "Couldn't open " << M.getModuleIdentifier()
<< " for dumping.\nError:" << EC.message() << "\n";

View File

@ -489,7 +489,7 @@ static void doExtract(StringRef Name, const object::Archive::Child &C) {
int FD;
failIfError(sys::fs::openFileForWrite(sys::path::filename(Name), FD,
sys::fs::CD_CreateAlways,
sys::fs::F_None, Mode),
sys::fs::OF_None, Mode),
Name);
{

View File

@ -82,7 +82,7 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
exit(1);

View File

@ -85,7 +85,7 @@ int main(int argc, char **argv) {
}
std::error_code EC;
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::OF_None);
if (EC) {
errs() << argv[0] << ": cannot open " << OutputFilename << " for writing: "
<< EC.message();

View File

@ -145,7 +145,7 @@ int main(int argc, const char *argv[]) {
exitWithErrorCode(RemappingBufOrError.getError(), RemappingFile);
std::error_code EC;
raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::F_Text);
raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_Text);
if (EC)
exitWithErrorCode(EC, OutputFilename);

View File

@ -186,7 +186,7 @@ int main(int argc, char **argv) {
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
return 1;

View File

@ -703,7 +703,7 @@ int main(int argc, char **argv) {
// Create the output file.
std::error_code EC;
ToolOutputFile OutFile(OutputFilename, EC, sys::fs::F_None);
ToolOutputFile OutFile(OutputFilename, EC, sys::fs::OF_None);
Optional<buffer_ostream> BOS;
raw_pwrite_stream *OS;
if (EC)

View File

@ -406,7 +406,7 @@ llvm::Error InstructionBenchmark::writeYaml(const LLVMState &State,
int ResultFD = 0;
if (auto E = llvm::errorCodeToError(
openFileForWrite(Filename, ResultFD, llvm::sys::fs::CD_CreateAlways,
llvm::sys::fs::F_Text))) {
llvm::sys::fs::OF_Text))) {
return E;
}
llvm::raw_fd_ostream Ostr(ResultFD, true /*shouldClose*/);

View File

@ -350,7 +350,7 @@ int main(int argc, char **argv) {
Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls
std::error_code EC;
ToolOutputFile Out(OutputFilename, EC, sys::fs::F_None);
ToolOutputFile Out(OutputFilename, EC, sys::fs::OF_None);
if (EC) {
errs() << EC.message() << '\n';
return 1;

View File

@ -381,7 +381,7 @@ int main(int argc, char **argv) {
errs() << "Here's the assembly:\n" << *Composite;
std::error_code EC;
ToolOutputFile Out(OutputFilename, EC, sys::fs::F_None);
ToolOutputFile Out(OutputFilename, EC, sys::fs::OF_None);
if (EC) {
WithColor::error() << EC.message() << '\n';
return 1;

View File

@ -420,7 +420,7 @@ static void createCombinedModuleSummaryIndex() {
std::error_code EC;
assert(!OutputFilename.empty());
raw_fd_ostream OS(OutputFilename + ".thinlto.bc", EC,
sys::fs::OpenFlags::F_None);
sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputFilename + ".thinlto.bc'");
WriteIndexToFile(CombinedIndex, OS);
OS.close();
@ -510,7 +510,7 @@ static std::unique_ptr<Module> loadModuleFromInput(lto::InputFile &File,
static void writeModuleToFile(Module &TheModule, StringRef Filename) {
std::error_code EC;
raw_fd_ostream OS(Filename, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(Filename, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + Filename + "'");
maybeVerifyModule(TheModule);
WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
@ -581,7 +581,7 @@ private:
if (!CombinedIndex)
report_fatal_error("ThinLink didn't create an index");
std::error_code EC;
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputFilename + "'");
WriteIndexToFile(*CombinedIndex, OS);
}
@ -619,7 +619,7 @@ private:
}
OutputName = getThinLTOOutputFile(OutputName, OldPrefix, NewPrefix);
std::error_code EC;
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputName + "'");
WriteIndexToFile(*Index, OS, &ModuleToSummariesForIndex);
}
@ -802,7 +802,7 @@ private:
}
std::error_code EC;
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputName + "'");
OS << std::get<0>(BinName)->getBuffer();
}
@ -848,7 +848,7 @@ private:
for (unsigned BufID = 0; BufID < Binaries.size(); ++BufID) {
auto OutputName = InputFilenames[BufID] + ".thinlto.o";
std::error_code EC;
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::F_None);
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputName + "'");
OS << Binaries[BufID]->getBuffer();
}
@ -1020,7 +1020,7 @@ int main(int argc, char **argv) {
if (Parallelism != 1)
PartFilename += "." + utostr(I);
std::error_code EC;
OSs.emplace_back(PartFilename, EC, sys::fs::F_None);
OSs.emplace_back(PartFilename, EC, sys::fs::OF_None);
if (EC)
error("error opening the file '" + PartFilename + "': " + EC.message());
OSPtrs.push_back(&OSs.back().os());

View File

@ -333,7 +333,7 @@ static int run(int argc, char **argv) {
std::string Path = OutputFilename + "." + utostr(Task);
std::error_code EC;
auto S = llvm::make_unique<raw_fd_ostream>(Path, EC, sys::fs::F_None);
auto S = llvm::make_unique<raw_fd_ostream>(Path, EC, sys::fs::OF_None);
check(EC, Path);
return llvm::make_unique<lto::NativeObjectStream>(std::move(S));
};

View File

@ -211,7 +211,7 @@ int AssembleOneInput(const uint8_t *Data, size_t Size) {
std::error_code EC;
const std::string OutputFilename = "-";
auto Out =
llvm::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::F_None);
llvm::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_None);
if (EC) {
errs() << EC.message() << '\n';
abort();

View File

@ -211,7 +211,7 @@ static const Target *GetTarget(const char *ProgName) {
static std::unique_ptr<ToolOutputFile> GetOutputStream(StringRef Path) {
std::error_code EC;
auto Out = llvm::make_unique<ToolOutputFile>(Path, EC, sys::fs::F_None);
auto Out = llvm::make_unique<ToolOutputFile>(Path, EC, sys::fs::OF_None);
if (EC) {
WithColor::error() << EC.message() << '\n';
return nullptr;

View File

@ -222,7 +222,7 @@ ErrorOr<std::unique_ptr<ToolOutputFile>> getOutputStream() {
OutputFilename = "-";
std::error_code EC;
auto Out =
llvm::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::F_None);
llvm::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_None);
if (!EC)
return std::move(Out);
return EC;

View File

@ -54,7 +54,7 @@ int main(int argc, char **argv) {
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
ExitOnErr(errorCodeToError(EC));
if (BinaryExtract) {

View File

@ -242,8 +242,7 @@ static bool readLocationInfo(LocationInfoTy &LocationInfo) {
static bool writeReport(LocationInfoTy &LocationInfo) {
std::error_code EC;
llvm::raw_fd_ostream OS(OutputFileName, EC,
llvm::sys::fs::F_Text);
llvm::raw_fd_ostream OS(OutputFileName, EC, llvm::sys::fs::OF_Text);
if (EC) {
WithColor::error() << "Can't open file " << OutputFileName << ": "
<< EC.message() << "\n";

View File

@ -380,7 +380,7 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
}
std::error_code EC;
raw_fd_ostream Output(OutputFilename.data(), EC, sys::fs::F_None);
raw_fd_ostream Output(OutputFilename.data(), EC, sys::fs::OF_None);
if (EC)
exitWithErrorCode(EC, OutputFilename);
@ -682,7 +682,7 @@ static int overlap_main(int argc, const char *argv[]) {
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data overlap tool\n");
std::error_code EC;
raw_fd_ostream OS(Output.data(), EC, sys::fs::F_Text);
raw_fd_ostream OS(Output.data(), EC, sys::fs::OF_Text);
if (EC)
exitWithErrorCode(EC, Output);
@ -1027,7 +1027,7 @@ static int show_main(int argc, const char *argv[]) {
}
std::error_code EC;
raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::F_Text);
raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_Text);
if (EC)
exitWithErrorCode(EC, OutputFilename);

View File

@ -55,7 +55,7 @@ int main(int argc, char **argv) {
SplitModule(std::move(M), NumOutputs, [&](std::unique_ptr<Module> MPart) {
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename + utostr(I++), EC, sys::fs::F_None));
new ToolOutputFile(OutputFilename + utostr(I++), EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
exit(1);

View File

@ -752,7 +752,7 @@ int main(int argc, char **argv) {
OutputFilename = "-";
std::error_code EC;
Out.reset(new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
Out.reset(new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
return 1;

View File

@ -421,7 +421,7 @@ static CommandRegistration Unused(&Account, []() -> Error {
}
std::error_code EC;
raw_fd_ostream OS(AccountOutput, EC, sys::fs::OpenFlags::F_Text);
raw_fd_ostream OS(AccountOutput, EC, sys::fs::OpenFlags::OF_Text);
if (EC)
return make_error<StringError>(
Twine("Cannot open file '") + AccountOutput + "' for writing.", EC);

View File

@ -387,8 +387,8 @@ static CommandRegistration Unused(&Convert, []() -> Error {
std::error_code EC;
raw_fd_ostream OS(ConvertOutput, EC,
ConvertOutputFormat == ConvertFormats::BINARY
? sys::fs::OpenFlags::F_None
: sys::fs::OpenFlags::F_Text);
? sys::fs::OpenFlags::OF_None
: sys::fs::OpenFlags::OF_Text);
if (EC)
return make_error<StringError>(
Twine("Cannot open file '") + ConvertOutput + "' for writing.", EC);

View File

@ -80,7 +80,7 @@ static CommandRegistration Unused(&Extract, []() -> Error {
InstrumentationMapOrError.takeError());
std::error_code EC;
raw_fd_ostream OS(ExtractOutput, EC, sys::fs::OpenFlags::F_Text);
raw_fd_ostream OS(ExtractOutput, EC, sys::fs::OpenFlags::OF_Text);
if (EC)
return make_error<StringError>(
Twine("Cannot open file '") + ExtractOutput + "' for writing.", EC);

View File

@ -470,7 +470,7 @@ static CommandRegistration Unused(&GraphDiff, []() -> Error {
auto &GDR = *GDROrErr;
std::error_code EC;
raw_fd_ostream OS(GraphDiffOutput, EC, sys::fs::OpenFlags::F_Text);
raw_fd_ostream OS(GraphDiffOutput, EC, sys::fs::OpenFlags::OF_Text);
if (EC)
return make_error<StringError>(
Twine("Cannot open file '") + GraphDiffOutput + "' for writing.", EC);

View File

@ -506,7 +506,7 @@ static CommandRegistration Unused(&GraphC, []() -> Error {
auto &GR = *GROrError;
std::error_code EC;
raw_fd_ostream OS(GraphOutput, EC, sys::fs::OpenFlags::F_Text);
raw_fd_ostream OS(GraphOutput, EC, sys::fs::OpenFlags::OF_Text);
if (EC)
return make_error<StringError>(
Twine("Cannot open file '") + GraphOutput + "' for writing.", EC);

View File

@ -612,7 +612,7 @@ int main(int argc, char **argv) {
OutputFilename = "-";
std::error_code EC;
Out.reset(new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
Out.reset(new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
return 1;
@ -620,7 +620,7 @@ int main(int argc, char **argv) {
if (!ThinLinkBitcodeFile.empty()) {
ThinLinkOut.reset(
new ToolOutputFile(ThinLinkBitcodeFile, EC, sys::fs::F_None));
new ToolOutputFile(ThinLinkBitcodeFile, EC, sys::fs::OF_None));
if (EC) {
errs() << EC.message() << '\n';
return 1;
@ -721,7 +721,7 @@ int main(int argc, char **argv) {
std::error_code EC;
Out = llvm::make_unique<ToolOutputFile>(OutputFilename, EC,
sys::fs::F_None);
sys::fs::OF_None);
if (EC) {
errs() << EC.message() << '\n';
return 1;

View File

@ -123,7 +123,7 @@ bool TempFile::init(const std::string &Ext) {
bool TempFile::writeBitcode(const Module &M) const {
LLVM_DEBUG(dbgs() << " - write bitcode\n");
std::error_code EC;
raw_fd_ostream OS(Filename, EC, sys::fs::F_None);
raw_fd_ostream OS(Filename, EC, sys::fs::OF_None);
if (EC) {
errs() << "verify-uselistorder: error: " << EC.message() << "\n";
return true;
@ -136,7 +136,7 @@ bool TempFile::writeBitcode(const Module &M) const {
bool TempFile::writeAssembly(const Module &M) const {
LLVM_DEBUG(dbgs() << " - write assembly\n");
std::error_code EC;
raw_fd_ostream OS(Filename, EC, sys::fs::F_Text);
raw_fd_ostream OS(Filename, EC, sys::fs::OF_Text);
if (EC) {
errs() << "verify-uselistorder: error: " << EC.message() << "\n";
return true;

View File

@ -77,7 +77,7 @@ int main(int argc, char **argv) {
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
if (EC)
error("yaml2obj: Error opening '" + OutputFilename + "': " + EC.message());

View File

@ -123,7 +123,7 @@ TEST_F(MagicTest, Magic) {
SmallString<128> file_pathname(TestDirectory);
llvm::sys::path::append(file_pathname, i->filename);
std::error_code EC;
raw_fd_ostream file(file_pathname, EC, sys::fs::F_None);
raw_fd_ostream file(file_pathname, EC, sys::fs::OF_None);
ASSERT_FALSE(file.has_error());
StringRef magic(i->magic_str, i->magic_str_len);
file << magic;

View File

@ -531,7 +531,7 @@ bool dwarfgen::Generator::saveFile(StringRef Path) {
if (FileBytes.empty())
return false;
std::error_code EC;
raw_fd_ostream Strm(Path, EC, sys::fs::F_None);
raw_fd_ostream Strm(Path, EC, sys::fs::OF_None);
if (EC)
return false;
Strm.write(FileBytes.data(), FileBytes.size());

View File

@ -44,7 +44,7 @@ struct SampleProfTest : ::testing::Test {
void createWriter(SampleProfileFormat Format, StringRef Profile) {
std::error_code EC;
std::unique_ptr<raw_ostream> OS(
new raw_fd_ostream(Profile, EC, sys::fs::F_None));
new raw_fd_ostream(Profile, EC, sys::fs::OF_None));
auto WriterOrErr = SampleProfileWriter::create(OS, Format);
ASSERT_TRUE(NoError(WriterOrErr.getError()));
Writer = std::move(WriterOrErr.get());

View File

@ -1021,7 +1021,7 @@ TEST_F(FileSystemTest, CarriageReturn) {
path::append(FilePathname, "test");
{
raw_fd_ostream File(FilePathname, EC, sys::fs::F_Text);
raw_fd_ostream File(FilePathname, EC, sys::fs::OF_Text);
ASSERT_NO_ERROR(EC);
File << '\n';
}
@ -1032,7 +1032,7 @@ TEST_F(FileSystemTest, CarriageReturn) {
}
{
raw_fd_ostream File(FilePathname, EC, sys::fs::F_None);
raw_fd_ostream File(FilePathname, EC, sys::fs::OF_None);
ASSERT_NO_ERROR(EC);
File << '\n';
}
@ -1418,7 +1418,7 @@ TEST_F(FileSystemTest, AppendSetsCorrectFileOffset) {
fs::CD_OpenExisting};
// Write some data and re-open it with every possible disposition (this is a
// hack that shouldn't work, but is left for compatibility. F_Append
// hack that shouldn't work, but is left for compatibility. OF_Append
// overrides
// the specified disposition.
for (fs::CreationDisposition Disp : Disps) {

View File

@ -339,7 +339,7 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
TEST(raw_fd_ostreamTest, multiple_raw_fd_ostream_to_stdout) {
std::error_code EC;
{ raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
{ raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
{ raw_fd_ostream("-", EC, sys::fs::OpenFlags::OF_None); }
{ raw_fd_ostream("-", EC, sys::fs::OpenFlags::OF_None); }
}
}