diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -21,8 +21,8 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" -#include "lldb/Utility/XcodeSDK.h" #include "lldb/Utility/UUID.h" +#include "lldb/Utility/XcodeSDK.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" @@ -128,7 +128,7 @@ Module(const ModuleSpec &module_spec); template - static lldb::ModuleSP CreateModuleFromObjectFile(Args &&... args) { + static lldb::ModuleSP CreateModuleFromObjectFile(Args &&...args) { // Must create a module and place it into a shared pointer before we can // create an object file since it has a std::weak_ptr back to the module, // so we need to control the creation carefully in this static function @@ -255,8 +255,7 @@ /// Returns a valid symbol pointer if a symbol was found, /// nullptr otherwise. const Symbol *FindFirstSymbolWithNameAndType( - ConstString name, - lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); + ConstString name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, @@ -439,12 +438,13 @@ /// /// \param searched_symbol_files /// Prevents one file from being visited multiple times. - void FindTypes(llvm::ArrayRef pattern, LanguageSet languages, - llvm::DenseSet &searched_symbol_files, - TypeMap &types); + void + FindTypes(llvm::ArrayRef pattern, LanguageSet languages, + llvm::DenseSet &searched_symbol_files, + TypeMap &types); - lldb::TypeSP FindFirstType(const SymbolContext &sc, - ConstString type_name, bool exact_match); + lldb::TypeSP FindFirstType(const SymbolContext &sc, ConstString type_name, + bool exact_match); /// Find types by name that are in a namespace. This function is used by the /// expression parser when searches need to happen in an exact namespace @@ -788,8 +788,7 @@ const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); - void SetFileSpecAndObjectName(const FileSpec &file, - ConstString object_name); + void SetFileSpecAndObjectName(const FileSpec &file, ConstString object_name); bool GetIsDynamicLinkEditor(); @@ -876,7 +875,7 @@ /// The value is returned as a reference to allow it to be updated by the /// ElapsedTime RAII object. StatsDuration &GetSymtabParseTime() { return m_symtab_parse_time; } - + /// Accessor for the symbol table index time metric. /// /// The value is returned as a reference to allow it to be updated by the @@ -949,27 +948,27 @@ protected: // Member Variables mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy - ///in multi-threaded environments. + /// in multi-threaded environments. /// The modification time for this module when it was created. llvm::sys::TimePoint<> m_mod_time; - ArchSpec m_arch; ///< The architecture for this module. + ArchSpec m_arch; ///< The architecture for this module. UUID m_uuid; ///< Each module is assumed to have a unique identifier to help - ///match it up to debug symbols. + /// match it up to debug symbols. FileSpec m_file; ///< The file representation on disk for this module (if - ///there is one). + /// there is one). FileSpec m_platform_file; ///< The path to the module on the platform on which - ///it is being debugged + /// it is being debugged FileSpec m_remote_install_file; ///< If set when debugging on remote - ///platforms, this module will be installed at - ///this location + /// platforms, this module will be installed + /// at this location FileSpec m_symfile_spec; ///< If this path is valid, then this is the file - ///that _will_ be used as the symbol file for this - ///module + /// that _will_ be used as the symbol file for this + /// module ConstString m_object_name; ///< The name an object within this module that is - ///selected, or empty of the module is represented - ///by \a m_file. + /// selected, or empty of the module is represented + /// by \a m_file. uint64_t m_object_offset = 0; llvm::sys::TimePoint<> m_object_mod_time; @@ -979,8 +978,8 @@ lldb::DataBufferSP m_data_sp; lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file - ///parser for this module as it may or may - ///not be shared with the SymbolFile + /// parser for this module as it may or may + /// not be shared with the SymbolFile llvm::Optional m_unwind_table; ///< Table of FuncUnwinders /// objects created for this /// Module's functions @@ -988,11 +987,11 @@ m_symfile_up; ///< A pointer to the symbol vendor for this module. std::vector m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and - ///changes the symbol file, + /// changes the symbol file, ///< we need to keep all old symbol files around in case anyone has type - ///references to them - TypeSystemMap m_type_system_map; ///< A map of any type systems associated - ///with this module + /// references to them + TypeSystemMap m_type_system_map; ///< A map of any type systems associated + /// with this module /// Module specific source remappings for when you have debug info for a /// module that doesn't match where the sources currently are. PathMappingList m_source_mappings = diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -181,7 +181,6 @@ virtual size_t ParseVariablesForContext(const SymbolContext &sc) = 0; virtual Type *ResolveTypeUID(lldb::user_id_t type_uid) = 0; - /// The characteristics of an array type. struct ArrayInfo { int64_t first_index = 0; @@ -318,19 +317,14 @@ /// /// \returns 0.0 if no information has been parsed or if there is /// no computational cost to parsing the debug information. - virtual StatsDuration GetDebugInfoParseTime() { - return StatsDuration(0.0); - } + virtual StatsDuration GetDebugInfoParseTime() { return StatsDuration(0.0); } /// Return the time it took to index the debug information in the object /// file. /// /// \returns 0.0 if the file doesn't need to be indexed or if it /// hasn't been indexed yet, or a valid duration if it has. - virtual StatsDuration GetDebugInfoIndexTime() { - return StatsDuration(0.0); - } - + virtual StatsDuration GetDebugInfoIndexTime() { return StatsDuration(0.0); } protected: void AssertModuleLock(); 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 @@ -233,8 +233,8 @@ Module::Module(const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name, lldb::offset_t object_offset, const llvm::sys::TimePoint<> &object_mod_time) - : m_mod_time(FileSystem::Instance().GetModificationTime(file_spec)), m_arch(arch), - m_file(file_spec), m_object_offset(object_offset), + : m_mod_time(FileSystem::Instance().GetModificationTime(file_spec)), + m_arch(arch), m_file(file_spec), m_object_offset(object_offset), m_object_mod_time(object_mod_time), m_file_has_changed(false), m_first_file_changed_log(false) { // Scope for locker below... @@ -559,9 +559,8 @@ // that the symbol has been resolved. if (so_addr.GetOffset() == addr_range.GetBaseAddress().GetOffset() || - so_addr.GetOffset() == - addr_range.GetBaseAddress().GetOffset() + - addr_range.GetByteSize()) { + so_addr.GetOffset() == addr_range.GetBaseAddress().GetOffset() + + addr_range.GetByteSize()) { resolved_flags |= flags; } } else { @@ -765,8 +764,7 @@ // pull anything out ConstString mangled_name(sc.GetFunctionName(Mangled::ePreferMangled)); ConstString full_name(sc.GetFunctionName()); - if (mangled_name != m_name && full_name != m_name) - { + if (mangled_name != m_name && full_name != m_name) { CPlusPlusLanguage::MethodName cpp_method(full_name); if (cpp_method.IsValid()) { if (cpp_method.GetContext().empty()) { @@ -959,8 +957,8 @@ } } -lldb::TypeSP Module::FindFirstType(const SymbolContext &sc, - ConstString name, bool exact_match) { +lldb::TypeSP Module::FindFirstType(const SymbolContext &sc, ConstString name, + bool exact_match) { TypeList type_list; llvm::DenseSet searched_symbol_files; FindTypes(name, exact_match, 1, searched_symbol_files, type_list); @@ -1331,9 +1329,8 @@ } } -void Module::FindFunctionSymbols(ConstString name, - uint32_t name_type_mask, - SymbolContextList &sc_list) { +void Module::FindFunctionSymbols(ConstString name, uint32_t name_type_mask, + SymbolContextList &sc_list) { LLDB_SCOPED_TIMERF("Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)", name.AsCString(), name_type_mask); if (Symtab *symtab = GetSymtab()) @@ -1341,8 +1338,8 @@ } void Module::FindSymbolsWithNameAndType(ConstString name, - SymbolType symbol_type, - SymbolContextList &sc_list) { + SymbolType symbol_type, + SymbolContextList &sc_list) { // No need to protect this call using m_mutex all other method calls are // already thread safe. if (Symtab *symtab = GetSymtab()) { @@ -1604,14 +1601,16 @@ return false; } -llvm::Optional Module::RemapSourceFile(llvm::StringRef path) const { +llvm::Optional +Module::RemapSourceFile(llvm::StringRef path) const { std::lock_guard guard(m_mutex); if (auto remapped = m_source_mappings.RemapPath(path)) return remapped->GetPath(); return {}; } -void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef sysroot) { +void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, + llvm::StringRef sysroot) { XcodeSDK sdk(sdk_name.str()); llvm::StringRef sdk_path(HostInfo::GetXcodeSDKPath(sdk)); if (sdk_path.empty()) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -253,8 +253,8 @@ ExternalTypeModuleMap; /// Return the list of Clang modules imported by this SymbolFile. - const ExternalTypeModuleMap& getExternalTypeModules() const { - return m_external_type_modules; + const ExternalTypeModuleMap &getExternalTypeModules() const { + return m_external_type_modules; } virtual DWARFDIE GetDIE(const DIERef &die_ref); @@ -328,7 +328,6 @@ return m_parse_time; } - protected: typedef llvm::DenseMap DIEToTypePtr; @@ -428,9 +427,10 @@ virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx); - virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE( - const DWARFDIE &die, lldb_private::ConstString type_name, - bool must_be_implementation); + virtual lldb::TypeSP + FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, + lldb_private::ConstString type_name, + bool must_be_implementation); lldb_private::Symbol * GetObjCClassSymbol(lldb_private::ConstString objc_class_name); 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 @@ -1097,7 +1097,8 @@ if (const char *include_path = module_die.GetAttributeValueAsString( DW_AT_LLVM_include_path, nullptr)) { FileSpec include_spec(include_path, dwarf_cu->GetPathStyle()); - MakeAbsoluteAndRemap(include_spec, *dwarf_cu, m_objfile_sp->GetModule()); + MakeAbsoluteAndRemap(include_spec, *dwarf_cu, + m_objfile_sp->GetModule()); module.search_path = ConstString(include_spec.GetPath()); } if (const char *sysroot = dwarf_cu->DIE().GetAttributeValueAsString( @@ -1924,7 +1925,7 @@ block_die = function_die.LookupDeepestBlock(file_vm_addr); } - if (!sc.function || ! lookup_block) + if (!sc.function || !lookup_block) return; Block &block = sc.function->GetBlock(true); @@ -2319,7 +2320,8 @@ if (log) { GetObjectFile()->GetModule()->LogMessage( log, - "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, sc_list)", + "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, " + "sc_list)", name.GetCString(), name_type_mask); } @@ -2352,8 +2354,7 @@ log, "SymbolFileDWARF::FindFunctions (name=\"%s\", " "name_type_mask=0x%x, include_inlines=%d, sc_list) => %u", - name.GetCString(), name_type_mask, include_inlines, - num_matches); + name.GetCString(), name_type_mask, include_inlines, num_matches); } } diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -147,9 +147,11 @@ // We assert that we have to module lock by trying to acquire the lock from a // different thread. Note that we must abort if the result is true to // guarantee correctness. - assert(std::async(std::launch::async, - [this] { return this->GetModuleMutex().try_lock(); }) - .get() == false && + assert(std::async( + std::launch::async, + [this] { + return this->GetModuleMutex().try_lock(); + }).get() == false && "Module is not locked"); #endif }