diff options
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index aef3f3e3b4b0..031892abdd24 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -613,11 +613,10 @@ void Module::FindCompileUnits(const FileSpec &path, const size_t num_compile_units = GetNumCompileUnits(); SymbolContext sc; sc.module_sp = shared_from_this(); - const bool compare_directory = (bool)path.GetDirectory(); for (size_t i = 0; i < num_compile_units; ++i) { sc.comp_unit = GetCompileUnitAtIndex(i).get(); if (sc.comp_unit) { - if (FileSpec::Equal(*sc.comp_unit, path, compare_directory)) + if (FileSpec::Match(path, sc.comp_unit->GetPrimaryFile())) sc_list.Append(sc); } } @@ -1006,12 +1005,14 @@ void Module::FindTypes( } } -void Module::FindTypes(llvm::ArrayRef<CompilerContext> pattern, - LanguageSet languages, TypeMap &types) { +void Module::FindTypes( + llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, + TypeMap &types) { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); if (SymbolFile *symbols = GetSymbolFile()) - symbols->FindTypes(pattern, languages, types); + symbols->FindTypes(pattern, languages, searched_symbol_files, types); } SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) { @@ -1058,34 +1059,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); @@ -1116,7 +1118,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; @@ -1142,7 +1144,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; @@ -1163,7 +1165,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); @@ -1176,7 +1178,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); @@ -1509,12 +1511,10 @@ bool Module::LoadScriptingResourceInTarget(Target *target, Status &error, return false; } StreamString scripting_stream; - scripting_fspec.Dump(&scripting_stream); - const bool can_reload = true; + scripting_fspec.Dump(scripting_stream.AsRawOstream()); const bool init_lldb_globals = false; bool did_load = script_interpreter->LoadScriptingModule( - scripting_stream.GetData(), can_reload, init_lldb_globals, - error); + scripting_stream.GetData(), init_lldb_globals, error); if (!did_load) return false; } @@ -1557,19 +1557,13 @@ bool Module::MatchesModuleSpec(const ModuleSpec &module_ref) { } const FileSpec &file_spec = module_ref.GetFileSpec(); - if (file_spec) { - if (!FileSpec::Equal(file_spec, m_file, (bool)file_spec.GetDirectory()) && - !FileSpec::Equal(file_spec, m_platform_file, - (bool)file_spec.GetDirectory())) - return false; - } + if (!FileSpec::Match(file_spec, m_file) && + !FileSpec::Match(file_spec, m_platform_file)) + return false; const FileSpec &platform_file_spec = module_ref.GetPlatformFileSpec(); - if (platform_file_spec) { - if (!FileSpec::Equal(platform_file_spec, GetPlatformFileSpec(), - (bool)platform_file_spec.GetDirectory())) - return false; - } + if (!FileSpec::Match(platform_file_spec, GetPlatformFileSpec())) + return false; const ArchSpec &arch = module_ref.GetArchitecture(); if (arch.IsValid()) { |