diff --git a/lldb/include/lldb/Symbol/CompileUnit.h b/lldb/include/lldb/Symbol/CompileUnit.h --- a/lldb/include/lldb/Symbol/CompileUnit.h +++ b/lldb/include/lldb/Symbol/CompileUnit.h @@ -13,6 +13,7 @@ #include "lldb/Core/ModuleChild.h" #include "lldb/Symbol/DebugMacros.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SourceModule.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/UserID.h" @@ -35,7 +36,6 @@ /// table. class CompileUnit : public std::enable_shared_from_this, public ModuleChild, - public FileSpec, public UserID, public SymbolContextScope { public: @@ -116,9 +116,6 @@ const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized); - /// Destructor - ~CompileUnit() override; - /// Add a function to this compile unit. /// /// Typically called by the SymbolFile plug-ins as they partially parse the @@ -225,6 +222,9 @@ const FileSpec *file_spec_ptr, bool exact, LineEntry *line_entry); + /// Return the primary source file associated with this compile unit. + const FileSpec &GetPrimaryFile() const { return m_file_spec; } + /// Get the line table for the compile unit. /// /// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins @@ -415,6 +415,8 @@ /// All modules, including the current module, imported by this /// compile unit. std::vector m_imported_modules; + /// The primary file associated with this compile unit. + FileSpec m_file_spec; /// Files associated with this compile unit's line table and /// declarations. FileSpecList m_support_files; diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -50,7 +50,7 @@ SBFileSpec file_spec; if (m_opaque_ptr) - file_spec.SetFileSpec(*m_opaque_ptr); + file_spec.SetFileSpec(m_opaque_ptr->GetPrimaryFile()); return LLDB_RECORD_RESULT(file_spec); } @@ -106,7 +106,7 @@ if (inline_file_spec && inline_file_spec->IsValid()) file_spec = inline_file_spec->ref(); else - file_spec = *m_opaque_ptr; + file_spec = m_opaque_ptr->GetPrimaryFile(); index = m_opaque_ptr->FindLineEntry( start_idx, line, inline_file_spec ? inline_file_spec->get() : nullptr, diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -638,7 +638,8 @@ } else { // Otherwise we will compare by name... if (old_sc.comp_unit && new_sc.comp_unit) { - if (FileSpec::Equal(*old_sc.comp_unit, *new_sc.comp_unit, true)) { + if (FileSpec::Equal(old_sc.comp_unit->GetPrimaryFile(), + new_sc.comp_unit->GetPrimaryFile(), true)) { // Now check the functions: if (old_sc.function && new_sc.function && (old_sc.function->GetName() == new_sc.function->GetName())) { diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -525,7 +525,7 @@ if (sc.comp_unit != nullptr) { s->EOL(); s->Indent("compile unit = "); - static_cast(sc.comp_unit)->GetFilename().Dump(s); + sc.comp_unit->GetPrimaryFile().GetFilename().Dump(s); if (sc.function != nullptr) { s->EOL(); diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -102,7 +102,7 @@ return eCallbackReturnContinue; CompileUnit *cu = context.comp_unit; - FileSpec cu_file_spec = *(static_cast(cu)); + FileSpec cu_file_spec = cu->GetPrimaryFile(); std::vector line_matches; context.target_sp->GetSourceManager().FindLinesMatchingRegex( cu_file_spec, m_regex, 1, UINT32_MAX, line_matches); diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -378,8 +378,10 @@ } } } else { - const char *cur_file_name = context.comp_unit->GetFilename().GetCString(); - const char *cur_dir_name = context.comp_unit->GetDirectory().GetCString(); + const char *cur_file_name = + context.comp_unit->GetPrimaryFile().GetFilename().GetCString(); + const char *cur_dir_name = + context.comp_unit->GetPrimaryFile().GetDirectory().GetCString(); bool match = false; if (m_file_name && cur_file_name && @@ -391,7 +393,7 @@ match = false; if (match) { - m_matching_files.AppendIfUnique(context.comp_unit); + m_matching_files.AppendIfUnique(context.comp_unit->GetPrimaryFile()); } } } diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -256,7 +256,8 @@ if (num_matches > 0) strm << "\n\n"; strm << "Lines found for file " << file_spec_name - << " in compilation unit " << cu->GetFilename() << " in `" + << " in compilation unit " + << cu->GetPrimaryFile().GetFilename() << " in `" << module_file_name << "\n"; cu_header_printed = true; } @@ -1077,7 +1078,8 @@ if (m_options.show_bp_locs) { m_breakpoint_locations.Clear(); const bool show_inlines = true; - m_breakpoint_locations.Reset(*sc.comp_unit, 0, show_inlines); + m_breakpoint_locations.Reset(sc.comp_unit->GetPrimaryFile(), 0, + show_inlines); SearchFilterForUnconstrainedSearches target_search_filter( target->shared_from_this()); target_search_filter.Search(m_breakpoint_locations); @@ -1106,8 +1108,8 @@ ? sc.line_entry.column : 0; target->GetSourceManager().DisplaySourceLinesWithLineNumbers( - sc.comp_unit, sc.line_entry.line, column, lines_to_back_up, - m_options.num_lines - lines_to_back_up, "->", + sc.comp_unit->GetPrimaryFile(), sc.line_entry.line, column, + lines_to_back_up, m_options.num_lines - lines_to_back_up, "->", &result.GetOutputStream(), GetBreakpointLocations()); result.SetStatus(eReturnStatusSuccessFinishResult); } @@ -1190,18 +1192,18 @@ if (num_matches > 1) { bool got_multiple = false; - FileSpec *test_cu_spec = nullptr; + CompileUnit *test_cu = nullptr; for (unsigned i = 0; i < num_matches; i++) { SymbolContext sc; sc_list.GetContextAtIndex(i, sc); if (sc.comp_unit) { - if (test_cu_spec) { - if (test_cu_spec != static_cast(sc.comp_unit)) + if (test_cu) { + if (test_cu != sc.comp_unit) got_multiple = true; break; } else - test_cu_spec = sc.comp_unit; + test_cu = sc.comp_unit; } } if (got_multiple) { @@ -1218,7 +1220,8 @@ if (sc.comp_unit) { if (m_options.show_bp_locs) { const bool show_inlines = true; - m_breakpoint_locations.Reset(*sc.comp_unit, 0, show_inlines); + m_breakpoint_locations.Reset(sc.comp_unit->GetPrimaryFile(), 0, + show_inlines); SearchFilterForUnconstrainedSearches target_search_filter( target->shared_from_this()); target_search_filter.Search(m_breakpoint_locations); @@ -1229,7 +1232,7 @@ m_options.num_lines = 10; const uint32_t column = 0; target->GetSourceManager().DisplaySourceLinesWithLineNumbers( - sc.comp_unit, m_options.start_line, column, 0, + sc.comp_unit->GetPrimaryFile(), m_options.start_line, column, 0, m_options.num_lines, "", &result.GetOutputStream(), GetBreakpointLocations()); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -816,15 +816,14 @@ return; if (sc.module_sp) { if (sc.comp_unit) { - s.Printf("Global variables for %s in %s:\n", - sc.comp_unit->GetPath().c_str(), - sc.module_sp->GetFileSpec().GetPath().c_str()); + s.Format("Global variables for {0} in {1}:\n", + sc.comp_unit->GetPrimaryFile(), sc.module_sp->GetFileSpec()); } else { s.Printf("Global variables for %s\n", sc.module_sp->GetFileSpec().GetPath().c_str()); } } else if (sc.comp_unit) { - s.Printf("Global variables for %s\n", sc.comp_unit->GetPath().c_str()); + s.Format("Global variables for {0}\n", sc.comp_unit->GetPrimaryFile()); } for (VariableSP var_sp : variable_list) { @@ -926,9 +925,9 @@ if (!success) { if (frame) { if (comp_unit) - result.AppendErrorWithFormat( - "no global variables in current compile unit: %s\n", - comp_unit->GetPath().c_str()); + result.AppendErrorWithFormatv( + "no global variables in current compile unit: {0}\n", + comp_unit->GetPrimaryFile()); else result.AppendErrorWithFormat( "no debug information for frame %u\n", @@ -1327,8 +1326,8 @@ if (i > 0) strm << "\n\n"; - strm << "Line table for " << *static_cast(sc.comp_unit) - << " in `" << module->GetFileSpec().GetFilename() << "\n"; + strm << "Line table for " << sc.comp_unit->GetPrimaryFile() << " in `" + << module->GetFileSpec().GetFilename() << "\n"; LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table) line_table->GetDescription( diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1193,7 +1193,7 @@ LineEntry line_entry; const bool exact = false; start_idx_ptr = sc.comp_unit->FindLineEntry( - start_idx_ptr, line_number, sc.comp_unit, exact, &line_entry); + start_idx_ptr, line_number, nullptr, exact, &line_entry); if (start_idx_ptr == UINT32_MAX) break; diff --git a/lldb/source/Core/FileLineResolver.cpp b/lldb/source/Core/FileLineResolver.cpp --- a/lldb/source/Core/FileLineResolver.cpp +++ b/lldb/source/Core/FileLineResolver.cpp @@ -36,8 +36,8 @@ Address *addr) { CompileUnit *cu = context.comp_unit; - if (m_inlines || - m_file_spec.Compare(*cu, m_file_spec, (bool)m_file_spec.GetDirectory())) { + if (m_inlines || m_file_spec.Compare(cu->GetPrimaryFile(), m_file_spec, + (bool)m_file_spec.GetDirectory())) { uint32_t start_file_idx = 0; uint32_t file_idx = cu->GetSupportFiles().FindFileIndex(start_file_idx, m_file_spec, false); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1376,8 +1376,7 @@ if (sc) { CompileUnit *cu = sc->comp_unit; if (cu) { - // CompileUnit is a FileSpec - if (DumpFile(s, *cu, (FileKind)entry.number)) + if (DumpFile(s, cu->GetPrimaryFile(), (FileKind)entry.number)) return true; } } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -617,7 +617,8 @@ 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::Equal(sc.comp_unit->GetPrimaryFile(), path, + compare_directory)) sc_list.Append(sc); } } diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -726,8 +726,11 @@ if (m_cu_spec_list.GetSize() != 0) return false; // Has no comp_unit so can't pass the file check. } - if (m_cu_spec_list.FindFileIndex(0, sym_ctx.comp_unit, false) == UINT32_MAX) - return false; // Fails the file check + FileSpec cu_spec; + if (sym_ctx.comp_unit) + cu_spec = sym_ctx.comp_unit->GetPrimaryFile(); + if (m_cu_spec_list.FindFileIndex(0, cu_spec, false) == UINT32_MAX) + return false; // Fails the file check return SearchFilterByModuleList::ModulePasses(sym_ctx.module_sp); } @@ -736,8 +739,8 @@ } bool SearchFilterByModuleListAndCU::CompUnitPasses(CompileUnit &compUnit) { - bool in_cu_list = - m_cu_spec_list.FindFileIndex(0, compUnit, false) != UINT32_MAX; + bool in_cu_list = m_cu_spec_list.FindFileIndex(0, compUnit.GetPrimaryFile(), + false) != UINT32_MAX; if (in_cu_list) { ModuleSP module_sp(compUnit.GetModule()); if (module_sp) { @@ -787,8 +790,9 @@ CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(cu_idx); matchingContext.comp_unit = cu_sp.get(); if (matchingContext.comp_unit) { - if (m_cu_spec_list.FindFileIndex(0, *matchingContext.comp_unit, - false) != UINT32_MAX) { + if (m_cu_spec_list.FindFileIndex( + 0, matchingContext.comp_unit->GetPrimaryFile(), false) != + UINT32_MAX) { shouldContinue = DoCUIteration(module_sp, matchingContext, searcher); if (shouldContinue == Searcher::eCallbackReturnStop) diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -399,24 +399,25 @@ if (num_matches != 0) { if (num_matches > 1) { SymbolContext sc; - FileSpec *test_cu_spec = nullptr; + CompileUnit *test_cu = nullptr; for (unsigned i = 0; i < num_matches; i++) { sc_list.GetContextAtIndex(i, sc); if (sc.comp_unit) { - if (test_cu_spec) { - if (test_cu_spec != static_cast(sc.comp_unit)) + if (test_cu) { + if (test_cu != sc.comp_unit) got_multiple = true; break; } else - test_cu_spec = sc.comp_unit; + test_cu = sc.comp_unit; } } } if (!got_multiple) { SymbolContext sc; sc_list.GetContextAtIndex(0, sc); - m_file_spec = sc.comp_unit; + if (sc.comp_unit) + m_file_spec = sc.comp_unit->GetPrimaryFile(); m_mod_time = FileSystem::Instance().GetModificationTime(m_file_spec); } } diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -731,7 +731,7 @@ } if (next_addr) finish_sequence(); - data.support_files = map.translate(cu, *m_files); + data.support_files = map.translate(cu.GetPrimaryFile(), *m_files); } void SymbolFileBreakpad::ParseUnwindData() { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1046,7 +1046,8 @@ comp_unit.SetSupportFiles(ParseSupportFilesFromPrologue( comp_unit.GetModule(), line_table->Prologue, dwarf_cu->GetPathStyle(), - dwarf_cu->GetCompilationDirectory().GetCString(), FileSpec(comp_unit))); + dwarf_cu->GetCompilationDirectory().GetCString(), + comp_unit.GetPrimaryFile())); return true; } @@ -1951,7 +1952,7 @@ const bool full_match = (bool)file_spec.GetDirectory(); bool file_spec_matches_cu_file_spec = - FileSpec::Equal(file_spec, *dc_cu, full_match); + FileSpec::Equal(file_spec, dc_cu->GetPrimaryFile(), full_match); if (check_inlines || file_spec_matches_cu_file_spec) { SymbolContext sc(m_objfile_sp->GetModule()); sc.comp_unit = dc_cu; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -604,7 +604,7 @@ SymbolFileDWARFDebugMap::GetCompUnitInfo(const CompileUnit &comp_unit) { const uint32_t cu_count = GetNumCompileUnits(); for (uint32_t i = 0; i < cu_count; ++i) { - if (comp_unit == m_compile_unit_infos[i].compile_unit_sp.get()) + if (&comp_unit == m_compile_unit_infos[i].compile_unit_sp.get()) return &m_compile_unit_infos[i]; } return nullptr; diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -373,7 +373,7 @@ // LLDB uses the DWARF-like file numeration (one based), // the zeroth file is the compile unit itself - support_files.Insert(0, comp_unit); + support_files.Insert(0, comp_unit.GetPrimaryFile()); return true; } @@ -1780,7 +1780,6 @@ auto line_table = std::make_unique(&comp_unit); // Find contributions to `compiland` from all source and header files. - std::string path = comp_unit.GetPath(); auto files = m_session_up->getSourceFilesForCompiland(*compiland_up); if (!files) return false; diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp --- a/lldb/source/Symbol/CompileUnit.cpp +++ b/lldb/source/Symbol/CompileUnit.cpp @@ -21,30 +21,21 @@ const char *pathname, const lldb::user_id_t cu_sym_id, lldb::LanguageType language, lldb_private::LazyBool is_optimized) - : ModuleChild(module_sp), FileSpec(pathname), UserID(cu_sym_id), - m_user_data(user_data), m_language(language), m_flags(0), - m_support_files(), m_line_table_up(), m_variables(), - m_is_optimized(is_optimized) { - if (language != eLanguageTypeUnknown) - m_flags.Set(flagsParsedLanguage); - assert(module_sp); -} + : CompileUnit(module_sp, user_data, FileSpec(pathname), cu_sym_id, language, + is_optimized) {} CompileUnit::CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &fspec, const lldb::user_id_t cu_sym_id, lldb::LanguageType language, lldb_private::LazyBool is_optimized) - : ModuleChild(module_sp), FileSpec(fspec), UserID(cu_sym_id), - m_user_data(user_data), m_language(language), m_flags(0), - m_support_files(), m_line_table_up(), m_variables(), + : ModuleChild(module_sp), UserID(cu_sym_id), m_user_data(user_data), + m_language(language), m_flags(0), m_file_spec(fspec), m_is_optimized(is_optimized) { if (language != eLanguageTypeUnknown) m_flags.Set(flagsParsedLanguage); assert(module_sp); } -CompileUnit::~CompileUnit() {} - void CompileUnit::CalculateSymbolContext(SymbolContext *sc) { sc->comp_unit = this; GetModule()->CalculateSymbolContext(sc); @@ -63,7 +54,7 @@ lldb::DescriptionLevel level) const { const char *language = Language::GetNameForLanguageType(m_language); *s << "id = " << (const UserID &)*this << ", file = \"" - << (const FileSpec &)*this << "\", language = \"" << language << '"'; + << this->GetPrimaryFile() << "\", language = \"" << language << '"'; } void CompileUnit::ForeachFunction( @@ -117,8 +108,7 @@ s->Printf("%p: ", static_cast(this)); s->Indent(); *s << "CompileUnit" << static_cast(*this) << ", language = \"" - << language << "\", file = '" << static_cast(*this) - << "'\n"; + << language << "\", file = '" << GetPrimaryFile() << "'\n"; // m_types.Dump(s); @@ -255,7 +245,7 @@ std::vector file_indexes; const bool full_match = (bool)file_spec.GetDirectory(); bool file_spec_matches_cu_file_spec = - FileSpec::Equal(file_spec, *this, full_match); + FileSpec::Equal(file_spec, this->GetPrimaryFile(), full_match); // If we are not looking for inlined functions and our file spec doesn't // match then we are done... diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -340,7 +340,8 @@ "error: unable to find module " "shared pointer for function '%s' " "in %s\n", - GetName().GetCString(), m_comp_unit->GetPath().c_str()); + GetName().GetCString(), + m_comp_unit->GetPrimaryFile().GetPath().c_str()); } m_block.SetBlockInfoHasBeenParsed(true, true); } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -316,7 +316,7 @@ *s << "CompileUnit = " << comp_unit; if (comp_unit != nullptr) s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(), - *static_cast(comp_unit)); + comp_unit->GetPrimaryFile()); s->EOL(); s->Indent(); *s << "Function = " << function; @@ -1055,7 +1055,8 @@ // Next check the comp unit, but only if the SymbolContext was not // inlined. if (!was_inlined && sc.comp_unit != nullptr) { - if (!FileSpec::Equal(*(sc.comp_unit), *(m_file_spec_up.get()), false)) + if (!FileSpec::Equal(sc.comp_unit->GetPrimaryFile(), *m_file_spec_up, + false)) return false; } } diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -549,7 +549,8 @@ CompUnitSP CU; for (size_t Ind = 0; !CU && Ind < Module.GetNumCompileUnits(); ++Ind) { CompUnitSP Candidate = Module.GetCompileUnitAtIndex(Ind); - if (!Candidate || Candidate->GetFilename().GetStringRef() != File) + if (!Candidate || + Candidate->GetPrimaryFile().GetFilename().GetStringRef() != File) continue; if (CU) return make_string_error("Multiple compile units for file `{0}` found.", @@ -653,7 +654,8 @@ if (!comp_unit) return make_string_error("Connot parse compile unit {0}.", i); - outs() << "Processing '" << comp_unit->GetFilename().AsCString() + outs() << "Processing '" + << comp_unit->GetPrimaryFile().GetFilename().AsCString() << "' compile unit.\n"; LineTable *lt = comp_unit->GetLineTable();