uint32_t SymbolFilePDB::FindTypes( const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, lldb_private::TypeMap &types) { if (!append) types.Clear(); if (!name) return 0; searched_symbol_files.clear(); searched_symbol_files.insert(this); std::string name_str = name.AsCString(); // If this might be a regex, we have to return EVERY symbol and process them // one by one, which is going // to destroy performance on large PDB files. So try really hard not to use a // regex match. if (name_str.find_first_of("[]?*.-+\\") != std::string::npos) FindTypesByRegex(name_str, max_matches, types); else FindTypesByName(name_str, max_matches, types); return types.GetSize(); }
uint32_t SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types) { if (!append) types.Clear(); if (!m_objc_class_name_to_index.IsEmpty()) { TypeMap::iterator iter = m_objc_class_types.find(name); if (iter != m_objc_class_types.end()) { types.Insert(iter->second); return 1; } const Symtab::NameToIndexMap::Entry *match = m_objc_class_name_to_index.FindFirstValueForName(name.GetCString()); if (match == NULL) return 0; const bool isForwardDecl = false; const bool isInternal = true; ClangASTContext &ast = GetClangASTContext(); lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(), ast.GetTranslationUnitDecl(), isForwardDecl, isInternal, 0xffaaffaaffaaffaall); Declaration decl; lldb::TypeSP type(new Type (match->value, this, name, 0, // byte_size - don't change this from 0, we currently use that to identify these "synthetic" ObjC class types. NULL, // SymbolContextScope* 0, // encoding_uid Type::eEncodingInvalid, decl, objc_object_type, Type::eResolveStateFull)); m_objc_class_types[name] = type; types.Insert(type); return 1; } return 0; }
size_t NameToDIE::Find (const lldb_private::ConstString &name, std::vector<Info> &info_array) const { const char *name_cstr = name.AsCString(); const size_t initial_info_array_size = info_array.size(); collection::const_iterator pos, end = m_collection.end(); for (pos = m_collection.lower_bound (name_cstr); pos != end && pos->first == name_cstr; ++pos) { info_array.push_back (pos->second); } return info_array.size() - initial_info_array_size; }