diff options
| author | Eric Leese <leese@google.com> | 2021-07-30 13:08:00 +0200 |
|---|---|---|
| committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2021-07-30 13:34:51 +0200 |
| commit | e7b8ba103a8411fb25237727c3822d4c431e4814 (patch) | |
| tree | cf1d698e45039a1d48141c16a06e4f40ed3206dd /lldb/source/Symbol/CompileUnit.cpp | |
| parent | ce52e0339f0ae1e7ac915f041b3f4d32081f648e (diff) | |
[lldb] [DWARF-5] Be lazier about loading .dwo files
This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.
Review By: jankratochvil, dblaikie
Differential Revision: https://reviews.llvm.org/D100299
Diffstat (limited to 'lldb/source/Symbol/CompileUnit.cpp')
| -rw-r--r-- | lldb/source/Symbol/CompileUnit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp index 588ed4976d65..1b258516fac8 100644 --- a/lldb/source/Symbol/CompileUnit.cpp +++ b/lldb/source/Symbol/CompileUnit.cpp @@ -52,7 +52,7 @@ void CompileUnit::DumpSymbolContext(Stream *s) { void CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const { - const char *language = Language::GetNameForLanguageType(m_language); + const char *language = GetCachedLanguage(); *s << "id = " << (const UserID &)*this << ", file = \"" << this->GetPrimaryFile() << "\", language = \"" << language << '"'; } @@ -97,12 +97,18 @@ lldb::FunctionSP CompileUnit::FindFunction( return {}; } +const char *CompileUnit::GetCachedLanguage() const { + if (m_flags.IsClear(flagsParsedLanguage)) + return "<not loaded>"; + return Language::GetNameForLanguageType(m_language); +} + // Dump the current contents of this object. No functions that cause on demand // parsing of functions, globals, statics are called, so this is a good // function to call to get an idea of the current contents of the CompileUnit // object. void CompileUnit::Dump(Stream *s, bool show_context) const { - const char *language = Language::GetNameForLanguageType(m_language); + const char *language = GetCachedLanguage(); s->Printf("%p: ", static_cast<const void *>(this)); s->Indent(); |
