summaryrefslogtreecommitdiff
path: root/tools/llc
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-09-01 14:20:41 +0000
committerDan Gohman <gohman@apple.com>2010-09-01 14:20:41 +0000
commitd4c454317a38d65957edebe62bfc69fc8d9885e8 (patch)
treedbf117519d428f04854447edee010962e68e5753 /tools/llc
parent41154114f64c1531764236e9268d2a5ac52e3e91 (diff)
Make tool_output_file's raw_ostream instance a member variable instead
of a base class. This makes it possible to unregister the file from FilesToRemove when the file is done. Also, this eliminates the need for formatted_tool_output_file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r--tools/llc/llc.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 13fe71b1098..8bcc2d8d27e 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -123,9 +123,9 @@ GetFileNameRoot(const std::string &InputFilename) {
return outputFilename;
}
-static formatted_tool_output_file *GetOutputStream(const char *TargetName,
- Triple::OSType OS,
- const char *ProgName) {
+static tool_output_file *GetOutputStream(const char *TargetName,
+ Triple::OSType OS,
+ const char *ProgName) {
// If we don't yet have an output filename, make one.
if (OutputFilename.empty()) {
if (InputFilename == "-")
@@ -183,11 +183,7 @@ static formatted_tool_output_file *GetOutputStream(const char *TargetName,
return 0;
}
- formatted_tool_output_file *Out =
- new formatted_tool_output_file(*FDOut,
- formatted_raw_ostream::DELETE_STREAM);
-
- return Out;
+ return FDOut;
}
// main - Entry point for the llc compiler.
@@ -278,7 +274,7 @@ int main(int argc, char **argv) {
TargetMachine &Target = *target.get();
// Figure out where we are going to send the output...
- OwningPtr<formatted_tool_output_file> Out
+ OwningPtr<tool_output_file> Out
(GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
if (!Out) return 1;
@@ -314,15 +310,18 @@ int main(int argc, char **argv) {
Target.setMCRelaxAll(true);
}
- // Ask the target to add backend passes as necessary.
- if (Target.addPassesToEmitFile(PM, *Out, FileType, OLvl,
- NoVerify)) {
- errs() << argv[0] << ": target does not support generation of this"
- << " file type!\n";
- return 1;
- }
+ {
+ formatted_raw_ostream FOS(Out->os());
- PM.run(mod);
+ // Ask the target to add backend passes as necessary.
+ if (Target.addPassesToEmitFile(PM, FOS, FileType, OLvl, NoVerify)) {
+ errs() << argv[0] << ": target does not support generation of this"
+ << " file type!\n";
+ return 1;
+ }
+
+ PM.run(mod);
+ }
// Declare success.
Out->keep();