Skip to content

Commit 3fc649c

Browse files
committed
[Support] Rename tool_output_file to ToolOutputFile, NFC
This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
1 parent 8e30a1c commit 3fc649c

File tree

34 files changed

+88
-91
lines changed

34 files changed

+88
-91
lines changed

clang-tools-extra/modularize/ModuleAssistant.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// to modularize. It then calls a writeModuleMap function to set up the
2626
// module map file output and walk the module tree, outputting the module
2727
// map file using a stream obtained and managed by an
28-
// llvm::tool_output_file object.
28+
// llvm::ToolOutputFile object.
2929
//
3030
//===---------------------------------------------------------------------===//
3131

@@ -271,7 +271,7 @@ static bool writeModuleMap(llvm::StringRef ModuleMapPath,
271271

272272
// Set up module map output file.
273273
std::error_code EC;
274-
llvm::tool_output_file Out(FilePath, EC, llvm::sys::fs::F_Text);
274+
llvm::ToolOutputFile Out(FilePath, EC, llvm::sys::fs::F_Text);
275275
if (EC) {
276276
llvm::errs() << Argv0 << ": error opening " << FilePath << ":"
277277
<< EC.message() << "\n";
@@ -289,7 +289,7 @@ static bool writeModuleMap(llvm::StringRef ModuleMapPath,
289289
if (!RootModule->output(OS, 0))
290290
return false;
291291

292-
// Tell tool_output_file that we want to keep the file.
292+
// Tell ToolOutputFile that we want to keep the file.
293293
Out.keep();
294294

295295
return true;

clang-tools-extra/pp-trace/PPTrace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ int main(int Argc, const char **Argv) {
215215
} else {
216216
// Set up output file.
217217
std::error_code EC;
218-
llvm::tool_output_file Out(OutputFileName, EC, llvm::sys::fs::F_Text);
218+
llvm::ToolOutputFile Out(OutputFileName, EC, llvm::sys::fs::F_Text);
219219
if (EC) {
220220
llvm::errs() << "pp-trace: error creating " << OutputFileName << ":"
221221
<< EC.message() << "\n";
@@ -224,7 +224,7 @@ int main(int Argc, const char **Argv) {
224224

225225
HadErrors = outputPPTrace(CallbackCalls, Out.os());
226226

227-
// Tell tool_output_file that we want to keep the file.
227+
// Tell ToolOutputFile that we want to keep the file.
228228
if (HadErrors == 0)
229229
Out.keep();
230230
}

clang/lib/CodeGen/CodeGenAction.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,11 @@ namespace clang {
265265
Ctx.setDiagnosticsHotnessThreshold(
266266
CodeGenOpts.DiagnosticsHotnessThreshold);
267267

268-
std::unique_ptr<llvm::tool_output_file> OptRecordFile;
268+
std::unique_ptr<llvm::ToolOutputFile> OptRecordFile;
269269
if (!CodeGenOpts.OptRecordFile.empty()) {
270270
std::error_code EC;
271-
OptRecordFile =
272-
llvm::make_unique<llvm::tool_output_file>(CodeGenOpts.OptRecordFile,
273-
EC, sys::fs::F_None);
271+
OptRecordFile = llvm::make_unique<llvm::ToolOutputFile>(
272+
CodeGenOpts.OptRecordFile, EC, sys::fs::F_None);
274273
if (EC) {
275274
Diags.Report(diag::err_cannot_open_file) <<
276275
CodeGenOpts.OptRecordFile << EC.message();

libclc/utils/prepare-builtins.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ int main(int argc, char **argv) {
8484
}
8585

8686
std::error_code EC;
87-
std::unique_ptr<tool_output_file> Out
88-
(new tool_output_file(OutputFilename, EC, sys::fs::F_None));
87+
std::unique_ptr<ToolOutputFile> Out(
88+
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
8989
if (EC) {
9090
errs() << EC.message() << '\n';
9191
exit(1);

llvm/include/llvm/LTO/LTO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ std::string getThinLTOOutputFile(const std::string &Path,
7171
const std::string &NewPrefix);
7272

7373
/// Setup optimization remarks.
74-
Expected<std::unique_ptr<tool_output_file>>
74+
Expected<std::unique_ptr<ToolOutputFile>>
7575
setupOptimizationRemarks(LLVMContext &Context, StringRef LTORemarksFilename,
7676
bool LTOPassRemarksWithHotness, int Count = -1);
7777

llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ struct LTOCodeGenerator {
237237
bool ShouldEmbedUselists = false;
238238
bool ShouldRestoreGlobalsLinkage = false;
239239
TargetMachine::CodeGenFileType FileType = TargetMachine::CGFT_ObjectFile;
240-
std::unique_ptr<tool_output_file> DiagnosticOutputFile;
240+
std::unique_ptr<ToolOutputFile> DiagnosticOutputFile;
241241
bool Freestanding = false;
242242
};
243243
}

llvm/include/llvm/Support/ToolOutputFile.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88
//===----------------------------------------------------------------------===//
99
//
10-
// This file defines the tool_output_file class.
10+
// This file defines the ToolOutputFile class.
1111
//
1212
//===----------------------------------------------------------------------===//
1313

@@ -21,9 +21,9 @@ namespace llvm {
2121
/// This class contains a raw_fd_ostream and adds a few extra features commonly
2222
/// needed for compiler-like tool output files:
2323
/// - The file is automatically deleted if the process is killed.
24-
/// - The file is automatically deleted when the tool_output_file
24+
/// - The file is automatically deleted when the ToolOutputFile
2525
/// object is destroyed unless the client calls keep().
26-
class tool_output_file {
26+
class ToolOutputFile {
2727
/// This class is declared before the raw_fd_ostream so that it is constructed
2828
/// before the raw_fd_ostream is constructed and destructed after the
2929
/// raw_fd_ostream is destructed. It installs cleanups in its constructor and
@@ -45,10 +45,10 @@ class tool_output_file {
4545
public:
4646
/// This constructor's arguments are passed to to raw_fd_ostream's
4747
/// constructor.
48-
tool_output_file(StringRef Filename, std::error_code &EC,
49-
sys::fs::OpenFlags Flags);
48+
ToolOutputFile(StringRef Filename, std::error_code &EC,
49+
sys::fs::OpenFlags Flags);
5050

51-
tool_output_file(StringRef Filename, int FD);
51+
ToolOutputFile(StringRef Filename, int FD);
5252

5353
/// Return the contained raw_fd_ostream.
5454
raw_fd_ostream &os() { return OS; }

llvm/lib/LTO/LTO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
11661166
return BackendProc->wait();
11671167
}
11681168

1169-
Expected<std::unique_ptr<tool_output_file>>
1169+
Expected<std::unique_ptr<ToolOutputFile>>
11701170
lto::setupOptimizationRemarks(LLVMContext &Context,
11711171
StringRef LTORemarksFilename,
11721172
bool LTOPassRemarksWithHotness, int Count) {
@@ -1179,7 +1179,7 @@ lto::setupOptimizationRemarks(LLVMContext &Context,
11791179

11801180
std::error_code EC;
11811181
auto DiagnosticFile =
1182-
llvm::make_unique<tool_output_file>(Filename, EC, sys::fs::F_None);
1182+
llvm::make_unique<ToolOutputFile>(Filename, EC, sys::fs::F_None);
11831183
if (EC)
11841184
return errorCodeToError(EC);
11851185
Context.setDiagnosticsOutputFile(

llvm/lib/LTO/LTOBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ Expected<const Target *> initAndLookupTarget(Config &C, Module &Mod) {
349349
}
350350

351351
static void
352-
finalizeOptimizationRemarks(std::unique_ptr<tool_output_file> DiagOutputFile) {
352+
finalizeOptimizationRemarks(std::unique_ptr<ToolOutputFile> DiagOutputFile) {
353353
// Make sure we flush the diagnostic remarks file in case the linker doesn't
354354
// call the global destructors before exiting.
355355
if (!DiagOutputFile)

llvm/lib/LTO/LTOCodeGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool LTOCodeGenerator::writeMergedModules(StringRef Path) {
225225

226226
// create output file
227227
std::error_code EC;
228-
tool_output_file Out(Path, EC, sys::fs::F_None);
228+
ToolOutputFile Out(Path, EC, sys::fs::F_None);
229229
if (EC) {
230230
std::string ErrMsg = "could not open bitcode file for writing: ";
231231
ErrMsg += Path;
@@ -265,7 +265,7 @@ bool LTOCodeGenerator::compileOptimizedToFile(const char **Name) {
265265
}
266266

267267
// generate object file
268-
tool_output_file objFile(Filename, FD);
268+
ToolOutputFile objFile(Filename, FD);
269269

270270
bool genResult = compileOptimized(&objFile.os());
271271
objFile.os().close();

llvm/lib/Object/ArchiveWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Error llvm::writeArchive(StringRef ArcName,
394394
TmpArchiveFD, TmpArchive))
395395
return errorCodeToError(EC);
396396

397-
tool_output_file Output(TmpArchive, TmpArchiveFD);
397+
ToolOutputFile Output(TmpArchive, TmpArchiveFD);
398398
raw_fd_ostream &Out = Output.os();
399399
if (Thin)
400400
Out << "!<thin>\n";

llvm/lib/Support/ToolOutputFile.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- ToolOutputFile.cpp - Implement the tool_output_file class --------===//
1+
//===--- ToolOutputFile.cpp - Implement the ToolOutputFile class --------===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -7,7 +7,7 @@
77
//
88
//===----------------------------------------------------------------------===//
99
//
10-
// This implements the tool_output_file class.
10+
// This implements the ToolOutputFile class.
1111
//
1212
//===----------------------------------------------------------------------===//
1313

@@ -16,14 +16,14 @@
1616
#include "llvm/Support/Signals.h"
1717
using namespace llvm;
1818

19-
tool_output_file::CleanupInstaller::CleanupInstaller(StringRef Filename)
19+
ToolOutputFile::CleanupInstaller::CleanupInstaller(StringRef Filename)
2020
: Filename(Filename), Keep(false) {
2121
// Arrange for the file to be deleted if the process is killed.
2222
if (Filename != "-")
2323
sys::RemoveFileOnSignal(Filename);
2424
}
2525

26-
tool_output_file::CleanupInstaller::~CleanupInstaller() {
26+
ToolOutputFile::CleanupInstaller::~CleanupInstaller() {
2727
// Delete the file if the client hasn't told us not to.
2828
if (!Keep && Filename != "-")
2929
sys::fs::remove(Filename);
@@ -34,13 +34,13 @@ tool_output_file::CleanupInstaller::~CleanupInstaller() {
3434
sys::DontRemoveFileOnSignal(Filename);
3535
}
3636

37-
tool_output_file::tool_output_file(StringRef Filename, std::error_code &EC,
38-
sys::fs::OpenFlags Flags)
37+
ToolOutputFile::ToolOutputFile(StringRef Filename, std::error_code &EC,
38+
sys::fs::OpenFlags Flags)
3939
: Installer(Filename), OS(Filename, EC, Flags) {
4040
// If open fails, no cleanup is needed.
4141
if (EC)
4242
Installer.Keep = true;
4343
}
4444

45-
tool_output_file::tool_output_file(StringRef Filename, int FD)
45+
ToolOutputFile::ToolOutputFile(StringRef Filename, int FD)
4646
: Installer(Filename), OS(FD, true) {}

llvm/lib/TableGen/Main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) {
6161
return reportError(argv0, "the option -d must be used together with -o\n");
6262

6363
std::error_code EC;
64-
tool_output_file DepOut(DependFilename, EC, sys::fs::F_Text);
64+
ToolOutputFile DepOut(DependFilename, EC, sys::fs::F_Text);
6565
if (EC)
6666
return reportError(argv0, "error opening " + DependFilename + ":" +
6767
EC.message() + "\n");
@@ -97,7 +97,7 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *MainFn) {
9797
return 1;
9898

9999
std::error_code EC;
100-
tool_output_file Out(OutputFilename, EC, sys::fs::F_Text);
100+
ToolOutputFile Out(OutputFilename, EC, sys::fs::F_Text);
101101
if (EC)
102102
return reportError(argv0, "error opening " + OutputFilename + ":" +
103103
EC.message() + "\n");

llvm/tools/bugpoint/ExtractFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ BugDriver::extractMappedBlocksFromModule(const std::vector<BasicBlock *> &BBs,
385385
}
386386
sys::RemoveFileOnSignal(Filename);
387387

388-
tool_output_file BlocksToNotExtractFile(Filename.c_str(), FD);
388+
ToolOutputFile BlocksToNotExtractFile(Filename.c_str(), FD);
389389
for (std::vector<BasicBlock *>::const_iterator I = BBs.begin(), E = BBs.end();
390390
I != E; ++I) {
391391
BasicBlock *BB = *I;

llvm/tools/bugpoint/OptimizerDriver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static cl::opt<std::string>
5858
/// writeProgramToFile - This writes the current "Program" to the named bitcode
5959
/// file. If an error occurs, true is returned.
6060
///
61-
static bool writeProgramToFileAux(tool_output_file &Out, const Module *M) {
61+
static bool writeProgramToFileAux(ToolOutputFile &Out, const Module *M) {
6262
WriteBitcodeToFile(M, Out.os(), PreserveBitcodeUseListOrder);
6363
Out.os().close();
6464
if (!Out.os().has_error()) {
@@ -70,14 +70,14 @@ static bool writeProgramToFileAux(tool_output_file &Out, const Module *M) {
7070

7171
bool BugDriver::writeProgramToFile(const std::string &Filename, int FD,
7272
const Module *M) const {
73-
tool_output_file Out(Filename, FD);
73+
ToolOutputFile Out(Filename, FD);
7474
return writeProgramToFileAux(Out, M);
7575
}
7676

7777
bool BugDriver::writeProgramToFile(const std::string &Filename,
7878
const Module *M) const {
7979
std::error_code EC;
80-
tool_output_file Out(Filename, EC, sys::fs::F_None);
80+
ToolOutputFile Out(Filename, EC, sys::fs::F_None);
8181
if (!EC)
8282
return writeProgramToFileAux(Out, M);
8383
return true;
@@ -154,7 +154,7 @@ bool BugDriver::runPasses(Module *Program,
154154
return 1;
155155
}
156156

157-
tool_output_file InFile(InputFilename, InputFD);
157+
ToolOutputFile InFile(InputFilename, InputFD);
158158

159159
WriteBitcodeToFile(Program, InFile.os(), PreserveBitcodeUseListOrder);
160160
InFile.os().close();

llvm/tools/llc/llc.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
167167

168168
static int compileModule(char **, LLVMContext &);
169169

170-
static std::unique_ptr<tool_output_file>
171-
GetOutputStream(const char *TargetName, Triple::OSType OS,
172-
const char *ProgName) {
170+
static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
171+
Triple::OSType OS,
172+
const char *ProgName) {
173173
// If we don't yet have an output filename, make one.
174174
if (OutputFilename.empty()) {
175175
if (InputFilename == "-")
@@ -225,8 +225,7 @@ GetOutputStream(const char *TargetName, Triple::OSType OS,
225225
sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
226226
if (!Binary)
227227
OpenFlags |= sys::fs::F_Text;
228-
auto FDOut = llvm::make_unique<tool_output_file>(OutputFilename, EC,
229-
OpenFlags);
228+
auto FDOut = llvm::make_unique<ToolOutputFile>(OutputFilename, EC, OpenFlags);
230229
if (EC) {
231230
errs() << EC.message() << '\n';
232231
return nullptr;
@@ -322,11 +321,11 @@ int main(int argc, char **argv) {
322321
if (PassRemarksHotnessThreshold)
323322
Context.setDiagnosticsHotnessThreshold(PassRemarksHotnessThreshold);
324323

325-
std::unique_ptr<tool_output_file> YamlFile;
324+
std::unique_ptr<ToolOutputFile> YamlFile;
326325
if (RemarksFilename != "") {
327326
std::error_code EC;
328-
YamlFile = llvm::make_unique<tool_output_file>(RemarksFilename, EC,
329-
sys::fs::F_None);
327+
YamlFile =
328+
llvm::make_unique<ToolOutputFile>(RemarksFilename, EC, sys::fs::F_None);
330329
if (EC) {
331330
errs() << EC.message() << '\n';
332331
return 1;
@@ -470,7 +469,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
470469
Options.FloatABIType = FloatABIForCalls;
471470

472471
// Figure out where we are going to send the output.
473-
std::unique_ptr<tool_output_file> Out =
472+
std::unique_ptr<ToolOutputFile> Out =
474473
GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
475474
if (!Out) return 1;
476475

llvm/tools/llvm-as/llvm-as.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ static void WriteOutputFile(const Module *M) {
7272
}
7373

7474
std::error_code EC;
75-
std::unique_ptr<tool_output_file> Out(
76-
new tool_output_file(OutputFilename, EC, sys::fs::F_None));
75+
std::unique_ptr<ToolOutputFile> Out(
76+
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
7777
if (EC) {
7878
errs() << EC.message() << '\n';
7979
exit(1);

llvm/tools/llvm-cov/CodeCoverage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
446446
error(InputPath, EC.message());
447447
return;
448448
}
449-
tool_output_file InputTOF{InputPath, InputFD};
449+
ToolOutputFile InputTOF{InputPath, InputFD};
450450

451451
unsigned NumSymbols = 0;
452452
for (const auto &Function : Coverage.getCoveredFunctions()) {
@@ -464,7 +464,7 @@ void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
464464
error(OutputPath, EC.message());
465465
return;
466466
}
467-
tool_output_file OutputTOF{OutputPath, OutputFD};
467+
ToolOutputFile OutputTOF{OutputPath, OutputFD};
468468
OutputTOF.os().close();
469469

470470
// Invoke the demangler.

llvm/tools/llvm-dis/llvm-dis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ int main(int argc, char **argv) {
191191
}
192192

193193
std::error_code EC;
194-
std::unique_ptr<tool_output_file> Out(
195-
new tool_output_file(OutputFilename, EC, sys::fs::F_None));
194+
std::unique_ptr<ToolOutputFile> Out(
195+
new ToolOutputFile(OutputFilename, EC, sys::fs::F_None));
196196
if (EC) {
197197
errs() << EC.message() << '\n';
198198
return 1;

llvm/tools/llvm-extract/llvm-extract.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ int main(int argc, char **argv) {
296296
Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls
297297

298298
std::error_code EC;
299-
tool_output_file Out(OutputFilename, EC, sys::fs::F_None);
299+
ToolOutputFile Out(OutputFilename, EC, sys::fs::F_None);
300300
if (EC) {
301301
errs() << EC.message() << '\n';
302302
return 1;

llvm/tools/llvm-link/llvm-link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ int main(int argc, char **argv) {
383383
if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
384384

385385
std::error_code EC;
386-
tool_output_file Out(OutputFilename, EC, sys::fs::F_None);
386+
ToolOutputFile Out(OutputFilename, EC, sys::fs::F_None);
387387
if (EC) {
388388
errs() << EC.message() << '\n';
389389
return 1;

0 commit comments

Comments
 (0)