forked from OSchip/llvm-project
[lldb][NFC] Migrate to raw_ostream in Module::GetDescription
This commit is contained in:
parent
d8136f14f1
commit
c4c464f8a5
|
@ -190,7 +190,7 @@ public:
|
|||
lldb::ModuleSP CalculateSymbolContextModule() override;
|
||||
|
||||
void
|
||||
GetDescription(Stream *s,
|
||||
GetDescription(llvm::raw_ostream &s,
|
||||
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
|
||||
|
||||
/// Get the module path and object name.
|
||||
|
|
|
@ -245,7 +245,7 @@ bool SBModule::GetDescription(SBStream &description) {
|
|||
|
||||
ModuleSP module_sp(GetSP());
|
||||
if (module_sp) {
|
||||
module_sp->GetDescription(&strm);
|
||||
module_sp->GetDescription(strm.AsRawOstream());
|
||||
} else
|
||||
strm.PutCString("No value");
|
||||
|
||||
|
|
|
@ -1061,34 +1061,35 @@ std::string Module::GetSpecificationDescription() const {
|
|||
return spec;
|
||||
}
|
||||
|
||||
void Module::GetDescription(Stream *s, lldb::DescriptionLevel level) {
|
||||
void Module::GetDescription(llvm::raw_ostream &s,
|
||||
lldb::DescriptionLevel level) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
if (level >= eDescriptionLevelFull) {
|
||||
if (m_arch.IsValid())
|
||||
s->Printf("(%s) ", m_arch.GetArchitectureName());
|
||||
s << llvm::formatv("({0}) ", m_arch.GetArchitectureName());
|
||||
}
|
||||
|
||||
if (level == eDescriptionLevelBrief) {
|
||||
const char *filename = m_file.GetFilename().GetCString();
|
||||
if (filename)
|
||||
s->PutCString(filename);
|
||||
s << filename;
|
||||
} else {
|
||||
char path[PATH_MAX];
|
||||
if (m_file.GetPath(path, sizeof(path)))
|
||||
s->PutCString(path);
|
||||
s << path;
|
||||
}
|
||||
|
||||
const char *object_name = m_object_name.GetCString();
|
||||
if (object_name)
|
||||
s->Printf("(%s)", object_name);
|
||||
s << llvm::formatv("({0})", object_name);
|
||||
}
|
||||
|
||||
void Module::ReportError(const char *format, ...) {
|
||||
if (format && format[0]) {
|
||||
StreamString strm;
|
||||
strm.PutCString("error: ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelBrief);
|
||||
GetDescription(strm.AsRawOstream(), lldb::eDescriptionLevelBrief);
|
||||
strm.PutChar(' ');
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
@ -1119,7 +1120,7 @@ void Module::ReportErrorIfModifyDetected(const char *format, ...) {
|
|||
if (format) {
|
||||
StreamString strm;
|
||||
strm.PutCString("error: the object file ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelFull);
|
||||
GetDescription(strm.AsRawOstream(), lldb::eDescriptionLevelFull);
|
||||
strm.PutCString(" has been modified\n");
|
||||
|
||||
va_list args;
|
||||
|
@ -1145,7 +1146,7 @@ void Module::ReportWarning(const char *format, ...) {
|
|||
if (format && format[0]) {
|
||||
StreamString strm;
|
||||
strm.PutCString("warning: ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelFull);
|
||||
GetDescription(strm.AsRawOstream(), lldb::eDescriptionLevelFull);
|
||||
strm.PutChar(' ');
|
||||
|
||||
va_list args;
|
||||
|
@ -1166,7 +1167,7 @@ void Module::ReportWarning(const char *format, ...) {
|
|||
void Module::LogMessage(Log *log, const char *format, ...) {
|
||||
if (log != nullptr) {
|
||||
StreamString log_message;
|
||||
GetDescription(&log_message, lldb::eDescriptionLevelFull);
|
||||
GetDescription(log_message.AsRawOstream(), lldb::eDescriptionLevelFull);
|
||||
log_message.PutCString(": ");
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
@ -1179,7 +1180,7 @@ void Module::LogMessage(Log *log, const char *format, ...) {
|
|||
void Module::LogMessageVerboseBacktrace(Log *log, const char *format, ...) {
|
||||
if (log != nullptr) {
|
||||
StreamString log_message;
|
||||
GetDescription(&log_message, lldb::eDescriptionLevelFull);
|
||||
GetDescription(log_message.AsRawOstream(), lldb::eDescriptionLevelFull);
|
||||
log_message.PutCString(": ");
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
|
|
@ -734,7 +734,7 @@ bool DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos() {
|
|||
if (!module_sp->IsLoadedInTarget(&target)) {
|
||||
if (log) {
|
||||
StreamString s;
|
||||
module_sp->GetDescription(&s);
|
||||
module_sp->GetDescription(s.AsRawOstream());
|
||||
LLDB_LOGF(log, "Unloading pre-run module: %s.", s.GetData());
|
||||
}
|
||||
not_loaded_modules.Append(module_sp);
|
||||
|
|
|
@ -4094,7 +4094,7 @@ void Target::TargetEventData::Dump(Stream *s) const {
|
|||
if (i != 0)
|
||||
*s << ", ";
|
||||
m_module_list.GetModuleAtIndex(i)->GetDescription(
|
||||
s, lldb::eDescriptionLevelBrief);
|
||||
s->AsRawOstream(), lldb::eDescriptionLevelBrief);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue