summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-dis/llvm-dis.cpp2
-rw-r--r--llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp2
-rw-r--r--llvm/tools/llvm-mc/llvm-mc.cpp11
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp2
-rw-r--r--llvm/tools/opt/opt.cpp4
5 files changed, 13 insertions, 8 deletions
diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp
index ae3295171d1..d66299cbf76 100644
--- a/llvm/tools/llvm-dis/llvm-dis.cpp
+++ b/llvm/tools/llvm-dis/llvm-dis.cpp
@@ -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::OF_None));
+ new ToolOutputFile(OutputFilename, EC, sys::fs::OF_Text));
if (EC) {
errs() << EC.message() << '\n';
return 1;
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 05a7aef67ec..e20f6041f98 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -584,7 +584,7 @@ int main(int argc, char **argv) {
}
std::error_code EC;
- ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_None);
+ ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_Text);
error("Unable to open output file" + OutputFilename, EC);
// Don't remove output file if we exit with an error.
OutputFile.keep();
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 832c46683b8..97d507028c1 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -209,9 +209,10 @@ static const Target *GetTarget(const char *ProgName) {
return TheTarget;
}
-static std::unique_ptr<ToolOutputFile> GetOutputStream(StringRef Path) {
+static std::unique_ptr<ToolOutputFile> GetOutputStream(StringRef Path,
+ sys::fs::OpenFlags Flags) {
std::error_code EC;
- auto Out = std::make_unique<ToolOutputFile>(Path, EC, sys::fs::OF_None);
+ auto Out = std::make_unique<ToolOutputFile>(Path, EC, Flags);
if (EC) {
WithColor::error() << EC.message() << '\n';
return nullptr;
@@ -413,7 +414,9 @@ int main(int argc, char **argv) {
FeaturesStr = Features.getString();
}
- std::unique_ptr<ToolOutputFile> Out = GetOutputStream(OutputFilename);
+ sys::fs::OpenFlags Flags = (FileType == OFT_AssemblyFile) ? sys::fs::OF_Text
+ : sys::fs::OF_None;
+ std::unique_ptr<ToolOutputFile> Out = GetOutputStream(OutputFilename, Flags);
if (!Out)
return 1;
@@ -423,7 +426,7 @@ int main(int argc, char **argv) {
WithColor::error() << "dwo output only supported with object files\n";
return 1;
}
- DwoOut = GetOutputStream(SplitDwarfFile);
+ DwoOut = GetOutputStream(SplitDwarfFile, sys::fs::OF_None);
if (!DwoOut)
return 1;
}
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 291ed540a8d..99c45eebdd8 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -238,7 +238,7 @@ ErrorOr<std::unique_ptr<ToolOutputFile>> getOutputStream() {
OutputFilename = "-";
std::error_code EC;
auto Out =
- std::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_None);
+ std::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_Text);
if (!EC)
return std::move(Out);
return EC;
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 638b29eca2a..15495a511d0 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -611,7 +611,9 @@ int main(int argc, char **argv) {
OutputFilename = "-";
std::error_code EC;
- Out.reset(new ToolOutputFile(OutputFilename, EC, sys::fs::OF_None));
+ sys::fs::OpenFlags Flags = OutputAssembly ? sys::fs::OF_Text
+ : sys::fs::OF_None;
+ Out.reset(new ToolOutputFile(OutputFilename, EC, Flags));
if (EC) {
errs() << EC.message() << '\n';
return 1;
OpenPOWER on IntegriCloud