Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -282,14 +282,9 @@ /// /// \param[in] namespace_decl /// If valid and module is non-NULL, the parent namespace. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. void FindExternalVisibleDecls(NameSearchContext &context, lldb::ModuleSP module, - CompilerDeclContext &namespace_decl, - unsigned int current_id); + CompilerDeclContext &namespace_decl); /// Find all Objective-C methods matching a given selector. /// @@ -356,13 +351,11 @@ protected: bool FindObjCMethodDeclsWithOrigin( - unsigned int current_id, NameSearchContext &context, + NameSearchContext &context, clang::ObjCInterfaceDecl *original_interface_decl, const char *log_info); - void FindDeclInModules(NameSearchContext &context, ConstString name, - unsigned current_id); - void FindDeclInObjCRuntime(NameSearchContext &context, ConstString name, - unsigned current_id); + void FindDeclInModules(NameSearchContext &context, ConstString name); + void FindDeclInObjCRuntime(NameSearchContext &context, ConstString name); friend struct NameSearchContext; Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -195,18 +195,14 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - if (log) { LLDB_LOG(log, - " CompleteTagDecl[{0}] on (ASTContext*){1} Completing " + " CompleteTagDecl on (ASTContext*){1} Completing " "(TagDecl*){2} named {3}", - current_id, m_clang_ast_context->getDisplayName(), tag_decl, + m_clang_ast_context->getDisplayName(), tag_decl, tag_decl->getName()); - LLDB_LOG(log, " CTD[%u] Before:\n{0}", current_id, - ClangUtil::DumpDecl(tag_decl)); + LLDB_LOG(log, " CTD Before:\n{0}", ClangUtil::DumpDecl(tag_decl)); } auto iter = m_active_lexical_decls.find(tag_decl); @@ -219,10 +215,8 @@ // We couldn't complete the type. Maybe there's a definition somewhere // else that can be completed. - LLDB_LOG(log, - " CTD[{0}] Type could not be completed in the module in " - "which it was first found.", - current_id); + LLDB_LOG(log, " CTD Type could not be completed in the module in " + "which it was first found."); bool found = false; @@ -234,9 +228,8 @@ m_ast_importer_sp->GetNamespaceMap(namespace_context); if (log && log->GetVerbose()) - LLDB_LOG(log, - " CTD[{0}] Inspecting namespace map{1} ({2} entries)", - current_id, namespace_map.get(), namespace_map->size()); + LLDB_LOG(log, " CTD Inspecting namespace map{1} ({2} entries)", + namespace_map.get(), namespace_map->size()); if (!namespace_map) return; @@ -244,9 +237,8 @@ for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e && !found; ++i) { - LLDB_LOG(log, " CTD[{0}] Searching namespace {1} in module {2}", - current_id, i->second.GetName(), - i->first->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CTD Searching namespace {1} in module {2}", + i->second.GetName(), i->first->GetFileSpec().GetFilename()); TypeList types; @@ -423,31 +415,27 @@ m_active_lexical_decls.insert(context_decl); ScopedLexicalDeclEraser eraser(m_active_lexical_decls, context_decl); - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - if (log) { if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) LLDB_LOG(log, - "FindExternalLexicalDecls[{0}] on (ASTContext*){1} '{2}' in " + "FindExternalLexicalDecls on (ASTContext*){1} '{2}' in " "'{3}' (%sDecl*){4}", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), + m_ast_context, m_clang_ast_context->getDisplayName(), context_named_decl->getNameAsString().c_str(), context_decl->getDeclKindName(), static_cast(context_decl)); else if (context_decl) LLDB_LOG(log, - "FindExternalLexicalDecls[{0}] on (ASTContext*){1} '{2}' in " + "FindExternalLexicalDecls on (ASTContext*){1} '{2}' in " "({3}Decl*){4}", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), + m_ast_context, m_clang_ast_context->getDisplayName(), context_decl->getDeclKindName(), static_cast(context_decl)); else LLDB_LOG(log, - "FindExternalLexicalDecls[{0}] on (ASTContext*){1} '{2}' in a " + "FindExternalLexicalDecls on (ASTContext*){1} '{2}' in a " "NULL context", - current_id, m_ast_context, - m_clang_ast_context->getDisplayName()); + m_ast_context, m_clang_ast_context->getDisplayName()); } ClangASTImporter::DeclOrigin original = m_ast_importer_sp->GetDeclOrigin(context_decl); @@ -455,7 +443,7 @@ if (!original.Valid()) return; - LLDB_LOG(log, " FELD[{0}] Original decl {1} (Decl*){2:x}:\n{3}", current_id, + LLDB_LOG(log, " FELD Original decl {1} (Decl*){2:x}:\n{3}", static_cast(original.ctx), static_cast(original.decl), ClangUtil::DumpDecl(original.decl)); @@ -500,12 +488,12 @@ std::string ast_dump = ClangUtil::DumpDecl(decl); if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) - LLDB_LOG( - log, " FELD[{0}] Adding [to {1}Decl {2}] lexical {3}Decl {4}", - current_id, context_named_decl->getDeclKindName(), - context_named_decl->getName(), decl->getDeclKindName(), ast_dump); + LLDB_LOG(log, " FELD Adding [to {1}Decl {2}] lexical {3}Decl {4}", + context_named_decl->getDeclKindName(), + context_named_decl->getName(), decl->getDeclKindName(), + ast_dump); else - LLDB_LOG(log, " FELD[{0}] Adding lexical {1}Decl {2}", current_id, + LLDB_LOG(log, " FELD Adding lexical {1}Decl {2}", decl->getDeclKindName(), ast_dump); } @@ -545,29 +533,25 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - if (log) { if (!context.m_decl_context) LLDB_LOG(log, - "ClangASTSource::FindExternalVisibleDecls[{0}] on " + "ClangASTSource::FindExternalVisibleDecls on " "(ASTContext*){1} '{2}' for '{3}' in a NULL DeclContext", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - name); + m_ast_context, m_clang_ast_context->getDisplayName(), name); else if (const NamedDecl *context_named_decl = dyn_cast(context.m_decl_context)) LLDB_LOG(log, - "ClangASTSource::FindExternalVisibleDecls[{0}] on " + "ClangASTSource::FindExternalVisibleDecls on " "(ASTContext*){1} '{2}' for '{3}' in '{4}'", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - name, context_named_decl->getName()); + m_ast_context, m_clang_ast_context->getDisplayName(), name, + context_named_decl->getName()); else LLDB_LOG(log, - "ClangASTSource::FindExternalVisibleDecls[{0}] on " + "ClangASTSource::FindExternalVisibleDecls on " "(ASTContext*){1} '{2}' for '{3}' in a '{4}'", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - name, context.m_decl_context->getDeclKindName()); + m_ast_context, m_clang_ast_context->getDisplayName(), name, + context.m_decl_context->getDeclKindName()); } context.m_namespace_map = std::make_shared(); @@ -578,9 +562,8 @@ m_ast_importer_sp->GetNamespaceMap(namespace_context); if (log && log->GetVerbose()) - LLDB_LOG(log, - " CAS::FEVD[{0}] Inspecting namespace map {1} ({2} entries)", - current_id, namespace_map.get(), namespace_map->size()); + LLDB_LOG(log, " CAS::FEVD Inspecting namespace map {1} ({2} entries)", + namespace_map.get(), namespace_map->size()); if (!namespace_map) return; @@ -588,11 +571,10 @@ for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) { - LLDB_LOG(log, " CAS::FEVD[{0}] Searching namespace {1} in module {2}", - current_id, i->second.GetName(), - i->first->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CAS::FEVD Searching namespace {1} in module {2}", + i->second.GetName(), i->first->GetFileSpec().GetFilename()); - FindExternalVisibleDecls(context, i->first, i->second, current_id); + FindExternalVisibleDecls(context, i->first, i->second); } } else if (isa(context.m_decl_context)) { FindObjCPropertyAndIvarDecls(context); @@ -602,18 +584,15 @@ } else { CompilerDeclContext namespace_decl; - LLDB_LOG(log, " CAS::FEVD[{0}] Searching the root namespace", current_id); + LLDB_LOG(log, " CAS::FEVD Searching the root namespace"); - FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl, - current_id); + FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl); } if (!context.m_namespace_map->empty()) { if (log && log->GetVerbose()) - LLDB_LOG(log, - " CAS::FEVD[{0}] Registering namespace map {1} ({2} entries)", - current_id, context.m_namespace_map.get(), - context.m_namespace_map->size()); + LLDB_LOG(log, " CAS::FEVD Registering namespace map {1} ({2} entries)", + context.m_namespace_map.get(), context.m_namespace_map->size()); NamespaceDecl *clang_namespace_decl = AddNamespace(context, context.m_namespace_map); @@ -646,7 +625,7 @@ void ClangASTSource::FindExternalVisibleDecls( NameSearchContext &context, lldb::ModuleSP module_sp, - CompilerDeclContext &namespace_decl, unsigned int current_id) { + CompilerDeclContext &namespace_decl) { assert(m_ast_context); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -671,8 +650,8 @@ std::pair( module_sp, found_namespace_decl)); - LLDB_LOG(log, " CAS::FEVD[{0}] Found namespace {1} in module {2}", - current_id, name, module_sp->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CAS::FEVD Found namespace {1} in module {2}", name, + module_sp->GetFileSpec().GetFilename()); } } } else { @@ -699,8 +678,8 @@ std::pair( image, found_namespace_decl)); - LLDB_LOG(log, " CAS::FEVD[{0}] Found namespace {1} in module {2}", - current_id, name, image->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CAS::FEVD Found namespace {1} in module {2}", name, + image->GetFileSpec().GetFilename()); } } } @@ -725,8 +704,7 @@ if (log) { const char *name_string = type_sp->GetName().GetCString(); - LLDB_LOG(log, " CAS::FEVD[{0}] Matching type found for \"{1}\": {2}", - current_id, name, + LLDB_LOG(log, " CAS::FEVD Matching type found for \"{1}\": {2}", name, (name_string ? name_string : "")); } @@ -735,8 +713,7 @@ CompilerType copied_clang_type(GuardedCopyType(full_type)); if (!copied_clang_type) { - LLDB_LOG(log, " CAS::FEVD[{0}] - Couldn't export a type", - current_id); + LLDB_LOG(log, " CAS::FEVD - Couldn't export a type"); continue; } @@ -750,11 +727,11 @@ if (!context.m_found.type) { // Try the modules next. - FindDeclInModules(context, name, current_id); + FindDeclInModules(context, name); } if (!context.m_found.type) { - FindDeclInObjCRuntime(context, name, current_id); + FindDeclInObjCRuntime(context, name); } } @@ -809,8 +786,8 @@ } bool ClangASTSource::FindObjCMethodDeclsWithOrigin( - unsigned int current_id, NameSearchContext &context, - ObjCInterfaceDecl *original_interface_decl, const char *log_info) { + NameSearchContext &context, ObjCInterfaceDecl *original_interface_decl, + const char *log_info) { const DeclarationName &decl_name(context.m_decl_name); clang::ASTContext *original_ctx = &original_interface_decl->getASTContext(); @@ -881,7 +858,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - LLDB_LOG(log, " CAS::FOMD[{0}] found ({1}) {2}", current_id, log_info, + LLDB_LOG(log, " CAS::FOMD found ({1}) {2}", log_info, ClangUtil::DumpDecl(copied_method_decl)); context.AddNamedDecl(copied_method_decl); @@ -891,7 +868,7 @@ } void ClangASTSource::FindDeclInModules(NameSearchContext &context, - ConstString name, unsigned current_id) { + ConstString name) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ClangModulesDeclVendor *modules_decl_vendor = @@ -908,9 +885,9 @@ if (log) { LLDB_LOG(log, - " CAS::FEVD[{0}] Matching entity found for \"{1}\" in " + " CAS::FEVD Matching entity found for \"{1}\" in " "the modules", - current_id, name); + name); } clang::NamedDecl *const decl_from_modules = decls[0]; @@ -923,9 +900,7 @@ copied_decl ? dyn_cast(copied_decl) : nullptr; if (!copied_named_decl) { - LLDB_LOG(log, - " CAS::FEVD[{0}] - Couldn't export a type from the modules", - current_id); + LLDB_LOG(log, " CAS::FEVD - Couldn't export a type from the modules"); return; } @@ -937,8 +912,7 @@ } void ClangASTSource::FindDeclInObjCRuntime(NameSearchContext &context, - ConstString name, - unsigned current_id) { + ConstString name) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); lldb::ProcessSP process(m_target->GetProcessSP()); @@ -965,9 +939,8 @@ return; if (log) { - LLDB_LOG(log, - " CAS::FEVD[{0}] Matching type found for \"{0}\" in the runtime", - current_id, name); + LLDB_LOG(log, " CAS::FEVD Matching type found for \"{0}\" in the runtime", + name); } clang::Decl *copied_decl = CopyDecl(decls[0]); @@ -975,8 +948,7 @@ copied_decl ? dyn_cast(copied_decl) : nullptr; if (!copied_named_decl) { - LLDB_LOG(log, " CAS::FEVD[{0}] - Couldn't export a type from the runtime", - current_id); + LLDB_LOG(log, " CAS::FEVD - Couldn't export a type from the runtime"); return; } @@ -987,9 +959,6 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - const DeclarationName &decl_name(context.m_decl_name); const DeclContext *decl_ctx(context.m_decl_context); @@ -1008,8 +977,8 @@ ObjCInterfaceDecl *original_interface_decl = dyn_cast(original.decl); - if (FindObjCMethodDeclsWithOrigin(current_id, context, - original_interface_decl, "at origin")) + if (FindObjCMethodDeclsWithOrigin(context, original_interface_decl, + "at origin")) return; // found it, no need to look any further } while (false); @@ -1035,9 +1004,9 @@ ConstString selector_name(ss.GetString()); LLDB_LOG(log, - "ClangASTSource::FindObjCMethodDecls[{0}] on (ASTContext*){1} '{2}' " + "ClangASTSource::FindObjCMethodDecls on (ASTContext*){1} '{2}' " "for selector [{3} {4}]", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), + m_ast_context, m_clang_ast_context->getDisplayName(), interface_decl->getName(), selector_name); SymbolContextList sc_list; @@ -1158,7 +1127,7 @@ if (!copied_method_decl) continue; - LLDB_LOG(log, " CAS::FOMD[{0}] found (in symbols)\n{1}", current_id, + LLDB_LOG(log, " CAS::FOMD found (in symbols)\n{1}", ClangUtil::DumpDecl(copied_method_decl)); context.AddNamedDecl(copied_method_decl); @@ -1187,12 +1156,11 @@ break; // already checked this one LLDB_LOG(log, - "CAS::FOPD[{0}] trying origin " + "CAS::FOPD trying origin " "(ObjCInterfaceDecl*){1}/(ASTContext*){2}...", - current_id, complete_interface_decl, - &complete_iface_decl->getASTContext()); + complete_interface_decl, &complete_iface_decl->getASTContext()); - FindObjCMethodDeclsWithOrigin(current_id, context, complete_interface_decl, + FindObjCMethodDeclsWithOrigin(context, complete_interface_decl, "in debug info"); return; @@ -1219,8 +1187,8 @@ if (!interface_decl_from_modules) break; - if (FindObjCMethodDeclsWithOrigin( - current_id, context, interface_decl_from_modules, "in modules")) + if (FindObjCMethodDeclsWithOrigin(context, interface_decl_from_modules, + "in modules")) return; } } while (false); @@ -1260,13 +1228,13 @@ if (!runtime_interface_decl) break; - FindObjCMethodDeclsWithOrigin(current_id, context, runtime_interface_decl, + FindObjCMethodDeclsWithOrigin(context, runtime_interface_decl, "in runtime"); } while (false); } static bool FindObjCPropertyAndIvarDeclsWithOrigin( - unsigned int current_id, NameSearchContext &context, ClangASTSource &source, + NameSearchContext &context, ClangASTSource &source, DeclFromUser &origin_iface_decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1288,7 +1256,7 @@ DeclFromParser parser_property_decl( origin_property_decl.Import(source)); if (parser_property_decl.IsValid()) { - LLDB_LOG(log, " CAS::FOPD[{0}] found\n{1}", current_id, + LLDB_LOG(log, " CAS::FOPD found\n{1}", ClangUtil::DumpDecl(parser_property_decl.decl)); context.AddNamedDecl(parser_property_decl.decl); @@ -1304,7 +1272,7 @@ origin_ivar_decl.Import(source)); if (parser_ivar_decl.IsValid()) { if (log) { - LLDB_LOG(log, " CAS::FOPD[{0}] found\n{1}", current_id, + LLDB_LOG(log, " CAS::FOPD found\n{1}", ClangUtil::DumpDecl(parser_ivar_decl.decl)); } @@ -1319,9 +1287,6 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - DeclFromParser parser_iface_decl( cast(context.m_decl_context)); DeclFromUser origin_iface_decl( @@ -1330,21 +1295,19 @@ ConstString class_name(parser_iface_decl->getNameAsString().c_str()); LLDB_LOG(log, - "ClangASTSource::FindObjCPropertyAndIvarDecls[{0}] on " + "ClangASTSource::FindObjCPropertyAndIvarDecls on " "(ASTContext*){1} '{2}' for '{3}.{4}'", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), + m_ast_context, m_clang_ast_context->getDisplayName(), parser_iface_decl->getName(), context.m_decl_name.getAsString()); - if (FindObjCPropertyAndIvarDeclsWithOrigin( - current_id, context, *this, origin_iface_decl)) + if (FindObjCPropertyAndIvarDeclsWithOrigin(context, *this, origin_iface_decl)) return; LLDB_LOG(log, - "CAS::FOPD[{0}] couldn't find the property on origin " + "CAS::FOPD couldn't find the property on origin " "(ObjCInterfaceDecl*){1}/(ASTContext*){2}, searching " "elsewhere...", - current_id, origin_iface_decl.decl, - &origin_iface_decl->getASTContext()); + origin_iface_decl.decl, &origin_iface_decl->getASTContext()); SymbolContext null_sc; TypeList type_list; @@ -1366,13 +1329,11 @@ break; // already checked this one LLDB_LOG(log, - "CAS::FOPD[{0}] trying origin " + "CAS::FOPD trying origin " "(ObjCInterfaceDecl*){1}/(ASTContext*){2}...", - current_id, complete_iface_decl.decl, - &complete_iface_decl->getASTContext()); + complete_iface_decl.decl, &complete_iface_decl->getASTContext()); - FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this, - complete_iface_decl); + FindObjCPropertyAndIvarDeclsWithOrigin(context, *this, complete_iface_decl); return; } while (false); @@ -1403,10 +1364,10 @@ LLDB_LOG(log, "CAS::FOPD[{0}] trying module " "(ObjCInterfaceDecl*){1}/(ASTContext*){2}...", - current_id, interface_decl_from_modules.decl, + interface_decl_from_modules.decl, &interface_decl_from_modules->getASTContext()); - if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this, + if (FindObjCPropertyAndIvarDeclsWithOrigin(context, *this, interface_decl_from_modules)) return; } while (false); @@ -1447,11 +1408,11 @@ LLDB_LOG(log, "CAS::FOPD[{0}] trying runtime " "(ObjCInterfaceDecl*){1}/(ASTContext*){2}...", - current_id, interface_decl_from_runtime.decl, + interface_decl_from_runtime.decl, &interface_decl_from_runtime->getASTContext()); - if (FindObjCPropertyAndIvarDeclsWithOrigin( - current_id, context, *this, interface_decl_from_runtime)) + if (FindObjCPropertyAndIvarDeclsWithOrigin(context, *this, + interface_decl_from_runtime)) return; } while (false); } @@ -1541,16 +1502,14 @@ FieldOffsetMap &field_offsets, BaseOffsetMap &base_offsets, BaseOffsetMap &virtual_base_offsets) { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, - "LayoutRecordType[{0}] on (ASTContext*){1} '{2}' for (RecordDecl*)" + "LayoutRecordType on (ASTContext*){1} '{2}' for (RecordDecl*)" "{3} [name = '{4}']", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - record, record->getName()); + m_ast_context, m_clang_ast_context->getDisplayName(), record, + record->getName()); DeclFromParser parser_record(record); DeclFromUser origin_record( @@ -1614,23 +1573,23 @@ m_ast_context->getCharWidth(); if (log) { - LLDB_LOG(log, "LRT[{0}] returned:", current_id); - LLDB_LOG(log, "LRT[{0}] Original = (RecordDecl*)%p", current_id, + LLDB_LOG(log, "LRT returned:"); + LLDB_LOG(log, "LRT Original = (RecordDecl*)%p", static_cast(origin_record.decl)); - LLDB_LOG(log, "LRT[{0}] Size = %" PRId64, current_id, size); - LLDB_LOG(log, "LRT[{0}] Alignment = %" PRId64, current_id, alignment); - LLDB_LOG(log, "LRT[{0}] Fields:", current_id); + LLDB_LOG(log, "LRT Size = %" PRId64, size); + LLDB_LOG(log, "LRT Alignment = %" PRId64, alignment); + LLDB_LOG(log, "LRT Fields:"); for (RecordDecl::field_iterator fi = record->field_begin(), fe = record->field_end(); fi != fe; ++fi) { LLDB_LOG(log, "LRT[{0}] (FieldDecl*){1}, Name = '{2}', Offset = {3} bits", - current_id, *fi, fi->getName(), field_offsets[*fi]); + *fi, fi->getName(), field_offsets[*fi]); } DeclFromParser parser_cxx_record = DynCast(parser_record); if (parser_cxx_record.IsValid()) { - LLDB_LOG(log, "LRT[{0}] Bases:", current_id); + LLDB_LOG(log, "LRT Bases:"); for (CXXRecordDecl::base_class_const_iterator bi = parser_cxx_record->bases_begin(), be = parser_cxx_record->bases_end(); @@ -1644,16 +1603,16 @@ DynCast(base_record); LLDB_LOG(log, - "LRT[{0}] {1}(CXXRecordDecl*){2}, Name = '{3}', Offset = " + "LRT {1}(CXXRecordDecl*){2}, Name = '{3}', Offset = " "{4} chars", - current_id, (is_virtual ? "Virtual " : ""), - base_cxx_record.decl, base_cxx_record.decl->getName(), + (is_virtual ? "Virtual " : ""), base_cxx_record.decl, + base_cxx_record.decl->getName(), (is_virtual ? virtual_base_offsets[base_cxx_record.decl].getQuantity() : base_offsets[base_cxx_record.decl].getQuantity())); } } else { - LLDB_LOG(log, "LRD[{0}] Not a CXXRecord, so no bases", current_id); + LLDB_LOG(log, "LRD Not a CXXRecord, so no bases"); } } @@ -1663,24 +1622,21 @@ void ClangASTSource::CompleteNamespaceMap( ClangASTImporter::NamespaceMapSP &namespace_map, ConstString name, ClangASTImporter::NamespaceMapSP &parent_map) const { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { if (parent_map && parent_map->size()) LLDB_LOG(log, - "CompleteNamespaceMap[{0}] on (ASTContext*){1} '{2}' Searching " + "CompleteNamespaceMap on (ASTContext*){1} '{2}' Searching " "for namespace {3} in namespace {4}", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - name, parent_map->begin()->second.GetName()); + m_ast_context, m_clang_ast_context->getDisplayName(), name, + parent_map->begin()->second.GetName()); else LLDB_LOG(log, - "CompleteNamespaceMap[{0}] on (ASTContext*){1} '{2}' Searching " + "CompleteNamespaceMap on (ASTContext*){1} '{2}' Searching " "for namespace {3}", - current_id, m_ast_context, m_clang_ast_context->getDisplayName(), - name); + m_ast_context, m_clang_ast_context->getDisplayName(), name); } if (parent_map) { @@ -1706,8 +1662,8 @@ namespace_map->push_back(std::pair( module_sp, found_namespace_decl)); - LLDB_LOG(log, " CMN[{0}] Found namespace {1} in module {2}", current_id, - name, module_sp->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CMN Found namespace {1} in module {2}", name, + module_sp->GetFileSpec().GetFilename()); } } else { const ModuleList &target_images = m_target->GetImages(); @@ -1737,8 +1693,8 @@ namespace_map->push_back(std::pair( image, found_namespace_decl)); - LLDB_LOG(log, " CMN[{0}] Found namespace {1} in module {2}", current_id, - name, image->GetFileSpec().GetFilename()); + LLDB_LOG(log, " CMN[{0}] Found namespace {1} in module {2}", name, + image->GetFileSpec().GetFilename()); } } } Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -275,14 +275,9 @@ /// /// \param[in] namespace_decl /// If valid and module is non-NULL, the parent namespace. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. void FindExternalVisibleDecls(NameSearchContext &context, lldb::ModuleSP module, - const CompilerDeclContext &namespace_decl, - unsigned int current_id); + const CompilerDeclContext &namespace_decl); protected: /// Retrieves the declaration with the given name from the storage of @@ -395,32 +390,19 @@ /// /// \param[in] name /// The name of the entities that need to be found. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. - void SearchPersistenDecls(NameSearchContext &context, const ConstString name, - unsigned int current_id); + void SearchPersistenDecls(NameSearchContext &context, const ConstString name); /// Handles looking up $__lldb_class which requires special treatment. /// /// \param[in] context /// The NameSearchContext that can construct Decls for this name. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. - void LookUpLldbClass(NameSearchContext &context, unsigned int current_id); + void LookUpLldbClass(NameSearchContext &context); /// Handles looking up $__lldb_objc_class which requires special treatment. /// /// \param[in] context /// The NameSearchContext that can construct Decls for this name. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. - void LookUpLldbObjCClass(NameSearchContext &context, unsigned int current_id); + void LookUpLldbObjCClass(NameSearchContext &context); /// Handles looking up the synthetic namespace that contains our local /// variables for the current frame. @@ -439,12 +421,7 @@ /// /// \param[in] name /// The name of the entities that need to be found. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. - void LookupInModulesDeclVendor(NameSearchContext &context, ConstString name, - unsigned current_id); + void LookupInModulesDeclVendor(NameSearchContext &context, ConstString name); /// Looks up a local variable. /// @@ -454,10 +431,6 @@ /// \param[in] name /// The name of the entities that need to be found. /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. - /// /// \param[in] sym_ctx /// The current SymbolContext of this frame. /// @@ -467,7 +440,7 @@ /// \return /// True iff a local variable was found. bool LookupLocalVariable(NameSearchContext &context, ConstString name, - unsigned current_id, SymbolContext &sym_ctx, + SymbolContext &sym_ctx, const CompilerDeclContext &namespace_decl); /// Searches for functions in the given SymbolContextList. @@ -500,14 +473,9 @@ /// /// \param[in] namespace_decl /// If valid and module is non-NULL, the parent namespace. - /// - /// \param[in] current_id - /// The ID for the current FindExternalVisibleDecls invocation, - /// for logging purposes. void LookupFunction(NameSearchContext &context, lldb::ModuleSP module_sp, ConstString name, - const CompilerDeclContext &namespace_decl, - unsigned current_id); + const CompilerDeclContext &namespace_decl); /// Given a target, find a variable that matches the given name and type. /// @@ -567,7 +535,7 @@ /// \param[in] valobj /// The LLDB ValueObject for that variable. void AddOneVariable(NameSearchContext &context, lldb::VariableSP var, - lldb::ValueObjectSP valobj, unsigned int current_id); + lldb::ValueObjectSP valobj); /// Use the NameSearchContext to generate a Decl for the given persistent /// variable, and put it in the list of found entities. @@ -577,18 +545,12 @@ /// /// \param[in] pvar_sp /// The persistent variable that needs a Decl. - /// - /// \param[in] current_id - /// The ID of the current invocation of FindExternalVisibleDecls - /// for logging purposes. void AddOneVariable(NameSearchContext &context, - lldb::ExpressionVariableSP &pvar_sp, - unsigned int current_id); + lldb::ExpressionVariableSP &pvar_sp); /// Use the NameSearchContext to generate a Decl for the given LLDB symbol /// (treated as a variable), and put it in the list of found entities. - void AddOneGenericVariable(NameSearchContext &context, const Symbol &symbol, - unsigned int current_id); + void AddOneGenericVariable(NameSearchContext &context, const Symbol &symbol); /// Use the NameSearchContext to generate a Decl for the given function. /// (Functions are not placed in the Tuple list.) Can handle both fully @@ -604,8 +566,7 @@ /// \param[in] sym /// The Symbol that corresponds to a function that needs to be /// created with generic type (unitptr_t foo(...)). - void AddOneFunction(NameSearchContext &context, Function *fun, Symbol *sym, - unsigned int current_id); + void AddOneFunction(NameSearchContext &context, Function *fun, Symbol *sym); /// Use the NameSearchContext to generate a Decl for the given register. /// @@ -614,8 +575,7 @@ /// /// \param[in] reg_info /// The information corresponding to that register. - void AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info, - unsigned int current_id); + void AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info); /// Use the NameSearchContext to generate a Decl for the given type. (Types /// are not placed in the Tuple list.) @@ -625,8 +585,7 @@ /// /// \param[in] type /// The type that needs to be created. - void AddOneType(NameSearchContext &context, const TypeFromUser &type, - unsigned int current_id); + void AddOneType(NameSearchContext &context, const TypeFromUser &type); /// Generate a Decl for "*this" and add a member function declaration to it /// for the expression, then report it. @@ -636,8 +595,7 @@ /// /// \param[in] type /// The type for *this. - void AddThisType(NameSearchContext &context, const TypeFromUser &type, - unsigned int current_id); + void AddThisType(NameSearchContext &context, const TypeFromUser &type); /// Move a type out of the current ASTContext into another, but make sure to /// export all components of the type also. Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -640,28 +640,24 @@ return; } - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; - if (log) { if (!context.m_decl_context) LLDB_LOGF(log, - "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for " + "ClangExpressionDeclMap::FindExternalVisibleDecls for " "'%s' in a NULL DeclContext", - current_id, name.GetCString()); + name.GetCString()); else if (const NamedDecl *context_named_decl = dyn_cast(context.m_decl_context)) LLDB_LOGF(log, - "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for " + "ClangExpressionDeclMap::FindExternalVisibleDecls for " "'%s' in '%s'", - current_id, name.GetCString(), + name.GetCString(), context_named_decl->getNameAsString().c_str()); else LLDB_LOGF(log, - "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for " + "ClangExpressionDeclMap::FindExternalVisibleDecls for " "'%s' in a '%s'", - current_id, name.GetCString(), - context.m_decl_context->getDeclKindName()); + name.GetCString(), context.m_decl_context->getDeclKindName()); } if (const NamespaceDecl *namespace_context = @@ -671,8 +667,7 @@ CompilerDeclContext compiler_decl_ctx = m_clang_ast_context->CreateDeclContext( const_cast(context.m_decl_context)); - FindExternalVisibleDecls(context, lldb::ModuleSP(), compiler_decl_ctx, - current_id); + FindExternalVisibleDecls(context, lldb::ModuleSP(), compiler_decl_ctx); return; } @@ -683,28 +678,27 @@ return; if (log && log->GetVerbose()) - log->Printf(" CEDM::FEVD[%u] Inspecting (NamespaceMap*)%p (%d entries)", - current_id, static_cast(namespace_map.get()), + log->Printf(" CEDM::FEVD Inspecting (NamespaceMap*)%p (%d entries)", + static_cast(namespace_map.get()), (int)namespace_map->size()); for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) { if (log) - log->Printf(" CEDM::FEVD[%u] Searching namespace %s in module %s", - current_id, i->second.GetName().AsCString(), + log->Printf(" CEDM::FEVD Searching namespace %s in module %s", + i->second.GetName().AsCString(), i->first->GetFileSpec().GetFilename().GetCString()); - FindExternalVisibleDecls(context, i->first, i->second, current_id); + FindExternalVisibleDecls(context, i->first, i->second); } } else if (isa(context.m_decl_context)) { CompilerDeclContext namespace_decl; if (log) - log->Printf(" CEDM::FEVD[%u] Searching the root namespace", current_id); + log->Printf(" CEDM::FEVD Searching the root namespace"); - FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl, - current_id); + FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl); } ClangASTSource::FindExternalVisibleDecls(context); @@ -733,8 +727,7 @@ } void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context, - const ConstString name, - unsigned int current_id) { + const ConstString name) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); NamedDecl *persistent_decl = GetPersistentDecl(name); @@ -757,14 +750,12 @@ MaybeRegisterFunctionBody(parser_function_decl); } - LLDB_LOGF(log, " CEDM::FEVD[%u] Found persistent decl %s", current_id, - name.GetCString()); + LLDB_LOG(log, " CEDM::FEVD Found persistent decl %s", name); context.AddNamedDecl(parser_named_decl); } -void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context, - unsigned int current_id) { +void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -779,8 +770,7 @@ if (!ctx_obj_ptr || status.Fail()) return; - AddThisType(context, TypeFromUser(m_ctx_obj->GetCompilerType()), - current_id); + AddThisType(context, TypeFromUser(m_ctx_obj->GetCompilerType())); m_struct_vars->m_object_pointer_type = TypeFromUser(ctx_obj_ptr->GetCompilerType()); @@ -815,10 +805,10 @@ TypeFromUser class_user_type(class_qual_type.getAsOpaquePtr(), function_decl_ctx.GetTypeSystem()); - LLDB_LOG(log, " CEDM::FEVD[{0}] Adding type for $__lldb_class: {1}", - current_id, class_qual_type.getAsString()); + LLDB_LOG(log, " CEDM::FEVD Adding type for $__lldb_class: {1}", + class_qual_type.getAsString()); - AddThisType(context, class_user_type, current_id); + AddThisType(context, class_user_type); if (method_decl->isInstance()) { // self is a pointer to the object @@ -857,17 +847,16 @@ TypeFromUser pointee_type = this_type->GetForwardCompilerType().GetPointeeType(); - LLDB_LOG(log, " FEVD[{0}] Adding type for $__lldb_class: {1}", current_id, + LLDB_LOG(log, " FEVD Adding type for $__lldb_class: {1}", ClangUtil::GetQualType(pointee_type).getAsString()); - AddThisType(context, pointee_type, current_id); + AddThisType(context, pointee_type); TypeFromUser this_user_type(this_type->GetFullCompilerType()); m_struct_vars->m_object_pointer_type = this_user_type; } } -void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext &context, - unsigned int current_id) { +void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext &context) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -878,7 +867,7 @@ if (!ctx_obj_ptr || status.Fail()) return; - AddOneType(context, TypeFromUser(m_ctx_obj->GetCompilerType()), current_id); + AddOneType(context, TypeFromUser(m_ctx_obj->GetCompilerType())); m_struct_vars->m_object_pointer_type = TypeFromUser(ctx_obj_ptr->GetCompilerType()); @@ -924,9 +913,9 @@ function_decl_ctx.GetTypeSystem()); LLDB_LOG(log, " FEVD[{0}] Adding type for $__lldb_objc_class: {1}", - current_id, ClangUtil::ToString(interface_type)); + ClangUtil::ToString(interface_type)); - AddOneType(context, class_user_type, current_id); + AddOneType(context, class_user_type); if (method_decl->isInstanceMethod()) { // self is a pointer to the object @@ -986,11 +975,11 @@ return; LLDB_LOG(log, " FEVD[{0}] Adding type for $__lldb_objc_class: {1}", - current_id, ClangUtil::ToString(self_type->GetFullCompilerType())); + ClangUtil::ToString(self_type->GetFullCompilerType())); TypeFromUser class_user_type(self_clang_type); - AddOneType(context, class_user_type, current_id); + AddOneType(context, class_user_type); TypeFromUser self_user_type(self_type->GetFullCompilerType()); @@ -1024,7 +1013,7 @@ } void ClangExpressionDeclMap::LookupInModulesDeclVendor( - NameSearchContext &context, ConstString name, unsigned current_id) { + NameSearchContext &context, ConstString name) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!m_target) @@ -1045,16 +1034,14 @@ clang::NamedDecl *const decl_from_modules = decls[0]; LLDB_LOG(log, - " CAS::FEVD[{0}] Matching decl found for " + " CAS::FEVD Matching decl found for " "\"{1}\" in the modules", - current_id, name); + name); clang::Decl *copied_decl = CopyDecl(decl_from_modules); if (!copied_decl) { - LLDB_LOG(log, - " CAS::FEVD[{0}] - Couldn't export a " - "declaration from the modules", - current_id); + LLDB_LOG(log, " CAS::FEVD - Couldn't export a " + "declaration from the modules"); return; } @@ -1072,8 +1059,8 @@ } bool ClangExpressionDeclMap::LookupLocalVariable( - NameSearchContext &context, ConstString name, unsigned current_id, - SymbolContext &sym_ctx, const CompilerDeclContext &namespace_decl) { + NameSearchContext &context, ConstString name, SymbolContext &sym_ctx, + const CompilerDeclContext &namespace_decl) { if (sym_ctx.block == nullptr) return false; @@ -1108,7 +1095,7 @@ if (var && !variable_found) { variable_found = true; ValueObjectSP valobj = ValueObjectVariable::Create(frame, var); - AddOneVariable(context, var, valobj, current_id); + AddOneVariable(context, var, valobj); context.m_found.variable = true; } } @@ -1215,7 +1202,7 @@ void ClangExpressionDeclMap::LookupFunction( NameSearchContext &context, lldb::ModuleSP module_sp, ConstString name, - const CompilerDeclContext &namespace_decl, unsigned current_id) { + const CompilerDeclContext &namespace_decl) { if (!m_parser_vars) return; @@ -1293,7 +1280,7 @@ if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr)) continue; - AddOneFunction(context, sym_ctx.function, nullptr, current_id); + AddOneFunction(context, sym_ctx.function, nullptr); context.m_found.function_with_type_info = true; context.m_found.function = true; } else if (sym_ctx.symbol) { @@ -1325,10 +1312,10 @@ if (!context.m_found.function_with_type_info) { if (extern_symbol) { - AddOneFunction(context, nullptr, extern_symbol, current_id); + AddOneFunction(context, nullptr, extern_symbol); context.m_found.function = true; } else if (non_extern_symbol) { - AddOneFunction(context, nullptr, non_extern_symbol, current_id); + AddOneFunction(context, nullptr, non_extern_symbol); context.m_found.function = true; } } @@ -1337,7 +1324,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( NameSearchContext &context, lldb::ModuleSP module_sp, - const CompilerDeclContext &namespace_decl, unsigned int current_id) { + const CompilerDeclContext &namespace_decl) { assert(m_ast_context); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1362,16 +1349,16 @@ // Try the persistent decls, which take precedence over all else. if (!namespace_decl) - SearchPersistenDecls(context, name, current_id); + SearchPersistenDecls(context, name); if (name.GetStringRef().startswith("$") && !namespace_decl) { if (name == "$__lldb_class") { - LookUpLldbClass(context, current_id); + LookUpLldbClass(context); return; } if (name == "$__lldb_objc_class") { - LookUpLldbObjCClass(context, current_id); + LookUpLldbObjCClass(context); return; } if (name == g_lldb_local_vars_namespace_cstr) { @@ -1391,7 +1378,7 @@ m_parser_vars->m_persistent_vars->GetVariable(name)); if (pvar_sp) { - AddOneVariable(context, pvar_sp, current_id); + AddOneVariable(context, pvar_sp); return; } @@ -1404,10 +1391,9 @@ reg_name)); if (reg_info) { - LLDB_LOGF(log, " CEDM::FEVD[%u] Found register %s", current_id, - reg_info->name); + LLDB_LOGF(log, " CEDM::FEVD Found register %s", reg_info->name); - AddOneRegister(context, reg_info, current_id); + AddOneRegister(context, reg_info); } } return; @@ -1416,7 +1402,7 @@ bool local_var_lookup = !namespace_decl || (namespace_decl.GetName() == g_lldb_local_vars_namespace_cstr); if (frame && local_var_lookup) - if (LookupLocalVariable(context, name, current_id, sym_ctx, namespace_decl)) + if (LookupLocalVariable(context, name, sym_ctx, namespace_decl)) return; if (target) { @@ -1426,17 +1412,17 @@ if (var) { valobj = ValueObjectVariable::Create(target, var); - AddOneVariable(context, var, valobj, current_id); + AddOneVariable(context, var, valobj); context.m_found.variable = true; return; } } - LookupFunction(context, module_sp, name, namespace_decl, current_id); + LookupFunction(context, module_sp, name, namespace_decl); // Try the modules next. if (!context.m_found.function_with_type_info) - LookupInModulesDeclVendor(context, name, current_id); + LookupInModulesDeclVendor(context, name); if (target && !context.m_found.variable && !namespace_decl) { // We couldn't find a non-symbol variable for this. Now we'll hunt for a @@ -1460,7 +1446,7 @@ m_ast_context->getDiagnostics().getCustomDiagID( clang::DiagnosticsEngine::Level::Warning, "%0"); m_ast_context->getDiagnostics().Report(diag_id) << warning.c_str(); - AddOneGenericVariable(context, *data_symbol, current_id); + AddOneGenericVariable(context, *data_symbol); context.m_found.variable = true; } } @@ -1556,8 +1542,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, VariableSP var, - ValueObjectSP valobj, - unsigned int current_id) { + ValueObjectSP valobj) { assert(m_parser_vars.get()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1608,15 +1593,12 @@ if (is_reference) entity->m_flags |= ClangExpressionVariable::EVTypeIsReference; - LLDB_LOG(log, - " CEDM::FEVD[{0}] Found variable {1}, returned\n{2} (original {3})", - current_id, decl_name, ClangUtil::DumpDecl(var_decl), - ClangUtil::ToString(ut)); + LLDB_LOG(log, " CEDM::FEVD Found variable {1}, returned\n{2} (original {3})", + decl_name, ClangUtil::DumpDecl(var_decl), ClangUtil::ToString(ut)); } void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, - ExpressionVariableSP &pvar_sp, - unsigned int current_id) { + ExpressionVariableSP &pvar_sp) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); TypeFromUser user_type( @@ -1625,8 +1607,8 @@ TypeFromParser parser_type(GuardedCopyType(user_type)); if (!parser_type.GetOpaqueQualType()) { - LLDB_LOGF(log, " CEDM::FEVD[%u] Couldn't import type for pvar %s", - current_id, pvar_sp->GetName().GetCString()); + LLDB_LOGF(log, " CEDM::FEVD Couldn't import type for pvar %s", + pvar_sp->GetName().GetCString()); return; } @@ -1642,13 +1624,12 @@ parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value.Clear(); - LLDB_LOG(log, " CEDM::FEVD[{0}] Added pvar {1}, returned\n{2}", current_id, + LLDB_LOG(log, " CEDM::FEVD Added pvar {1}, returned\n{2}", pvar_sp->GetName(), ClangUtil::DumpDecl(var_decl)); } void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, - const Symbol &symbol, - unsigned int current_id) { + const Symbol &symbol) { assert(m_parser_vars.get()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1695,13 +1676,12 @@ parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_sym = &symbol; - LLDB_LOG(log, " CEDM::FEVD[{0}] Found variable {1}, returned\n{2}", - current_id, decl_name, ClangUtil::DumpDecl(var_decl)); + LLDB_LOG(log, " CEDM::FEVD Found variable {1}, returned\n{2}", decl_name, + ClangUtil::DumpDecl(var_decl)); } void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context, - const RegisterInfo *reg_info, - unsigned int current_id) { + const RegisterInfo *reg_info) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); CompilerType clang_type = @@ -1735,14 +1715,13 @@ parser_vars->m_lldb_value.Clear(); entity->m_flags |= ClangExpressionVariable::EVBareRegister; - LLDB_LOG(log, " CEDM::FEVD[{0}] Added register {1}, returned\n{2}", - current_id, context.m_decl_name.getAsString(), - ClangUtil::DumpDecl(var_decl)); + LLDB_LOG(log, " CEDM::FEVD Added register {1}, returned\n{2}", + context.m_decl_name.getAsString(), ClangUtil::DumpDecl(var_decl)); } void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, - Function *function, Symbol *symbol, - unsigned int current_id) { + Function *function, + Symbol *symbol) { assert(m_parser_vars.get()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1785,9 +1764,9 @@ function->DumpSymbolContext(&ss); LLDB_LOG(log, - " CEDM::FEVD[{0}] Imported decl for function template" + " CEDM::FEVD Imported decl for function template" " {1} (description {2}), returned\n{3}", - current_id, copied_function_template->getNameAsString(), + copied_function_template->getNameAsString(), ss.GetData(), ClangUtil::DumpDecl(copied_function_template)); } @@ -1804,10 +1783,10 @@ function->DumpSymbolContext(&ss); LLDB_LOG(log, - " CEDM::FEVD[{0}]] Imported decl for function {1} " + " CEDM::FEVD Imported decl for function {1} " "(description {2}), returned\n{3}", - current_id, copied_function_decl->getNameAsString(), - ss.GetData(), ClangUtil::DumpDecl(copied_function_decl)); + copied_function_decl->getNameAsString(), ss.GetData(), + ClangUtil::DumpDecl(copied_function_decl)); } context.AddNamedDecl(copied_function_decl); @@ -1916,16 +1895,15 @@ Address::DumpStyleResolvedDescription); LLDB_LOG(log, - " CEDM::FEVD[{0}] Found {1} function {2} (description {3}), " + " CEDM::FEVD Found {1} function {2} (description {3}), " "returned\n{4}", - current_id, (function ? "specific" : "generic"), decl_name, - ss.GetData(), ClangUtil::DumpDecl(function_decl)); + (function ? "specific" : "generic"), decl_name, ss.GetData(), + ClangUtil::DumpDecl(function_decl)); } } void ClangExpressionDeclMap::AddThisType(NameSearchContext &context, - const TypeFromUser &ut, - unsigned int current_id) { + const TypeFromUser &ut) { CompilerType copied_clang_type = GuardedCopyType(ut); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -1994,8 +1972,7 @@ } void ClangExpressionDeclMap::AddOneType(NameSearchContext &context, - const TypeFromUser &ut, - unsigned int current_id) { + const TypeFromUser &ut) { CompilerType copied_clang_type = GuardedCopyType(ut); if (!copied_clang_type) { Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -30,17 +30,14 @@ bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName name) override { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? if (log) { LLDB_LOGF(log, - "AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%" - "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p", - current_id, + "AppleObjCExternalASTSource::FindExternalVisibleDeclsByName" + " on (ASTContext*)%p Looking for %s in (%sDecl*)%p", static_cast(&decl_ctx->getParentASTContext()), name.getAsString().c_str(), decl_ctx->getDeclKindName(), static_cast(decl_ctx)); @@ -70,44 +67,37 @@ } void CompleteType(clang::TagDecl *tag_decl) override { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? LLDB_LOGF(log, - "AppleObjCExternalASTSource::CompleteType[%u] on " + "AppleObjCExternalASTSource::CompleteType on " "(ASTContext*)%p Completing (TagDecl*)%p named %s", - current_id, static_cast(&tag_decl->getASTContext()), + static_cast(&tag_decl->getASTContext()), static_cast(tag_decl), tag_decl->getName().str().c_str()); - LLDB_LOG(log, " AOEAS::CT[{0}] Before:\n{1}", current_id, - ClangUtil::DumpDecl(tag_decl)); + LLDB_LOG(log, " AOEAS::CT Before:\n{1}", ClangUtil::DumpDecl(tag_decl)); - LLDB_LOG(log, " AOEAS::CT[{1}] After:{1}", current_id, - ClangUtil::DumpDecl(tag_decl)); + LLDB_LOG(log, " AOEAS::CT After:{1}", ClangUtil::DumpDecl(tag_decl)); return; } void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? if (log) { LLDB_LOGF(log, - "AppleObjCExternalASTSource::CompleteType[%u] on " + "AppleObjCExternalASTSource::CompleteType on " "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s", - current_id, static_cast(&interface_decl->getASTContext()), static_cast(interface_decl), interface_decl->getName().str().c_str()); - LLDB_LOGF(log, " AOEAS::CT[%u] Before:", current_id); + LLDB_LOGF(log, " AOEAS::CT Before:"); LLDB_LOG(log, " [CT] {0}", ClangUtil::DumpDecl(interface_decl)); } @@ -537,15 +527,13 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append, uint32_t max_matches, std::vector &decls) { - static unsigned int invocation_id = 0; - unsigned int current_id = invocation_id++; Log *log(GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? - LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )", - current_id, (const char *)name.AsCString(), - append ? "true" : "false", max_matches); + LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls ('%s', %s, %u, )", + (const char *)name.AsCString(), append ? "true" : "false", + max_matches); if (!append) decls.clear(); @@ -578,24 +566,21 @@ isa_value = metadata->GetISAPtr(); LLDB_LOG(log, - "AOCTV::FT [%u] Found %s (isa 0x%" PRIx64 - ") in the ASTContext", - current_id, result_iface_type.getAsString(), isa_value); + "AOCTV::FT Found %s (isa 0x%" PRIx64 ") in the ASTContext", + result_iface_type.getAsString(), isa_value); } decls.push_back(m_ast_ctx.GetCompilerDecl(result_iface_decl)); ret++; break; } else { - LLDB_LOGF(log, - "AOCTV::FT [%u] There's something in the ASTContext, but " - "it's not something we know about", - current_id); + LLDB_LOGF(log, "AOCTV::FT There's something in the ASTContext, but " + "it's not something we know about"); break; } } else if (log) { - LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find %s in the ASTContext", - current_id, name.AsCString()); + LLDB_LOGF(log, "AOCTV::FT Couldn't find %s in the ASTContext", + name.AsCString()); } // It's not. If it exists, we have to put it into our ASTContext. @@ -603,7 +588,7 @@ ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name); if (!isa) { - LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find the isa", current_id); + LLDB_LOGF(log, "AOCTV::FT Couldn't find the isa"); break; } @@ -612,9 +597,9 @@ if (!iface_decl) { LLDB_LOGF(log, - "AOCTV::FT [%u] Couldn't get the Objective-C interface for " + "AOCTV::FT Couldn't get the Objective-C interface for " "isa 0x%" PRIx64, - current_id, (uint64_t)isa); + (uint64_t)isa); break; } @@ -622,7 +607,7 @@ if (log) { clang::QualType new_iface_type = ast_ctx.getObjCInterfaceType(iface_decl); - LLDB_LOG(log, "AOCTV::FT [{0}] Created {1} (isa 0x{2:x})", current_id, + LLDB_LOG(log, "AOCTV::FT Created {1} (isa 0x{2:x})", new_iface_type.getAsString(), (uint64_t)isa); }