aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Symbol/CompileUnit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Symbol/CompileUnit.cpp')
-rw-r--r--lldb/source/Symbol/CompileUnit.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 588ed4976d65..7c840d8bb064 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();
@@ -175,6 +181,10 @@ void CompileUnit::SetSupportFiles(const FileSpecList &support_files) {
m_support_files = support_files;
}
+void CompileUnit::SetSupportFiles(FileSpecList &&support_files) {
+ m_support_files = std::move(support_files);
+}
+
DebugMacros *CompileUnit::GetDebugMacros() {
if (m_debug_macros_sp.get() == nullptr) {
if (m_flags.IsClear(flagsParsedDebugMacros)) {
@@ -309,8 +319,13 @@ void CompileUnit::ResolveSymbolContext(
// subsequent line exact matches below.
const bool inlines = false;
const bool exact = true;
- SourceLocationSpec found_entry(line_entry.file, line_entry.line,
- line_entry.column, inlines, exact);
+ const llvm::Optional<uint16_t> column =
+ src_location_spec.GetColumn().hasValue()
+ ? llvm::Optional<uint16_t>(line_entry.column)
+ : llvm::None;
+
+ SourceLocationSpec found_entry(line_entry.file, line_entry.line, column,
+ inlines, exact);
while (line_idx != UINT32_MAX) {
// If they only asked for the line entry, then we're done, we can