[Lldb-commits] [lldb] 2f1e7b3 - [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 3 23:29:12 PST 2019
Author: Raphael Isemann
Date: 2019-12-04T08:28:52+01:00
New Revision: 2f1e7b3d01e176e912477d52847c19d3847a43a0
URL: https://github.com/llvm/llvm-project/commit/2f1e7b3d01e176e912477d52847c19d3847a43a0
DIFF: https://github.com/llvm/llvm-project/commit/2f1e7b3d01e176e912477d52847c19d3847a43a0.diff
LOG: [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple
Reviewers: labath, davide
Reviewed By: davide
Subscribers: clayborg, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70979
Added:
Modified:
lldb/include/lldb/Core/ModuleSpec.h
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/TargetList.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/source/Utility/ProcessInfo.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 651d0dc869bc..26be59e3f4ae 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -207,7 +207,7 @@ class ModuleSpec {
if (dumped_something)
strm.PutCString(", ");
strm.Printf("arch = ");
- m_arch.DumpTriple(strm);
+ m_arch.DumpTriple(strm.AsRawOstream());
dumped_something = true;
}
if (m_uuid.IsValid()) {
diff --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h
index ae7958376832..15e2fdb10c32 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -433,7 +433,7 @@ class ArchSpec {
/// \return A triple describing this ArchSpec.
const llvm::Triple &GetTriple() const { return m_triple; }
- void DumpTriple(Stream &s) const;
+ void DumpTriple(llvm::raw_ostream &s) const;
/// Architecture triple setter.
///
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 9f4e58e55e5d..ac3188740234 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -78,7 +78,7 @@ static void DumpTargetInfo(uint32_t target_idx, Target *target,
uint32_t properties = 0;
if (target_arch.IsValid()) {
strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( ");
- target_arch.DumpTriple(strm);
+ target_arch.DumpTriple(strm.AsRawOstream());
properties++;
}
PlatformSP platform_sp(target->GetPlatform());
@@ -1291,7 +1291,7 @@ static void DumpModuleArchitecture(Stream &strm, Module *module,
StreamString arch_strm;
if (full_triple)
- module->GetArchitecture().DumpTriple(arch_strm);
+ module->GetArchitecture().DumpTriple(arch_strm.AsRawOstream());
else
arch_strm.PutCString(module->GetArchitecture().GetArchitectureName());
std::string arch_str = arch_strm.GetString();
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index c9849a9e5f09..aaf48f35f921 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -406,7 +406,7 @@ void Platform::GetStatus(Stream &strm) {
if (arch.IsValid()) {
if (!arch.GetTriple().str().empty()) {
strm.Printf(" Triple: ");
- arch.DumpTriple(strm);
+ arch.DumpTriple(strm.AsRawOstream());
strm.EOL();
}
}
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 7c7a36e97bbf..ebd02a504d09 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -144,9 +144,9 @@ Status TargetList::CreateTargetInternal(
StreamString platform_arch_strm;
StreamString module_arch_strm;
- platform_arch.DumpTriple(platform_arch_strm);
+ platform_arch.DumpTriple(platform_arch_strm.AsRawOstream());
matching_module_spec.GetArchitecture().DumpTriple(
- module_arch_strm);
+ module_arch_strm.AsRawOstream());
error.SetErrorStringWithFormat(
"the specified architecture '%s' is not compatible with '%s' "
"in '%s'",
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 38f6752b0348..2bebecb2c677 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -1450,17 +1450,17 @@ bool ArchSpec::IsAlwaysThumbInstructions() const {
return false;
}
-void ArchSpec::DumpTriple(Stream &s) const {
+void ArchSpec::DumpTriple(llvm::raw_ostream &s) const {
const llvm::Triple &triple = GetTriple();
llvm::StringRef arch_str = triple.getArchName();
llvm::StringRef vendor_str = triple.getVendorName();
llvm::StringRef os_str = triple.getOSName();
llvm::StringRef environ_str = triple.getEnvironmentName();
- s.Printf("%s-%s-%s", arch_str.empty() ? "*" : arch_str.str().c_str(),
- vendor_str.empty() ? "*" : vendor_str.str().c_str(),
- os_str.empty() ? "*" : os_str.str().c_str());
+ s << llvm::formatv("{0}-{1}-{2}", arch_str.empty() ? "*" : arch_str,
+ vendor_str.empty() ? "*" : vendor_str,
+ os_str.empty() ? "*" : os_str);
if (!environ_str.empty())
- s.Printf("-%s", environ_str.str().c_str());
+ s << "-" << environ_str;
}
diff --git a/lldb/source/Utility/ProcessInfo.cpp b/lldb/source/Utility/ProcessInfo.cpp
index 5743d223be4f..a02ee1af867a 100644
--- a/lldb/source/Utility/ProcessInfo.cpp
+++ b/lldb/source/Utility/ProcessInfo.cpp
@@ -49,7 +49,7 @@ llvm::StringRef ProcessInfo::GetNameAsStringRef() const {
void ProcessInfo::Dump(Stream &s, Platform *platform) const {
s << "Executable: " << GetName() << "\n";
s << "Triple: ";
- m_arch.DumpTriple(s);
+ m_arch.DumpTriple(s.AsRawOstream());
s << "\n";
s << "Arguments:\n";
@@ -137,7 +137,7 @@ void ProcessInstanceInfo::Dump(Stream &s, UserIDResolver &resolver) const {
if (m_arch.IsValid()) {
s.Printf(" arch = ");
- m_arch.DumpTriple(s);
+ m_arch.DumpTriple(s.AsRawOstream());
s.EOL();
}
@@ -189,7 +189,7 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, UserIDResolver &resolver,
StreamString arch_strm;
if (m_arch.IsValid())
- m_arch.DumpTriple(arch_strm);
+ m_arch.DumpTriple(arch_strm.AsRawOstream());
auto print = [&](bool (ProcessInstanceInfo::*isValid)() const,
uint32_t (ProcessInstanceInfo::*getID)() const,
More information about the lldb-commits
mailing list