| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SymbolFileSymtab.cpp ------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "SymbolFileSymtab.h" |
| 11 | #include "lldb/Core/Module.h" |
| 12 | #include "lldb/Core/PluginManager.h" |
| 13 | #include "lldb/Core/RegularExpression.h" |
| 14 | #include "lldb/Core/Timer.h" |
| 15 | #include "lldb/Symbol/ObjectFile.h" |
| 16 | #include "lldb/Symbol/Symtab.h" |
| 17 | #include "lldb/Symbol/ObjectFile.h" |
| 18 | #include "lldb/Symbol/Symbol.h" |
| 19 | #include "lldb/Symbol/CompileUnit.h" |
| 20 | #include "lldb/Symbol/SymbolContext.h" |
| 21 | #include "lldb/Symbol/Function.h" |
| 22 | |
| 23 | using namespace lldb; |
| 24 | using namespace lldb_private; |
| 25 | |
| 26 | void |
| 27 | SymbolFileSymtab::Initialize() |
| 28 | { |
| 29 | PluginManager::RegisterPlugin (GetPluginNameStatic(), |
| 30 | GetPluginDescriptionStatic(), |
| 31 | CreateInstance); |
| 32 | } |
| 33 | |
| 34 | void |
| 35 | SymbolFileSymtab::Terminate() |
| 36 | { |
| 37 | PluginManager::UnregisterPlugin (CreateInstance); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | const char * |
| 42 | SymbolFileSymtab::GetPluginNameStatic() |
| 43 | { |
| 44 | return "symbol-file.symtab"; |
| 45 | } |
| 46 | |
| 47 | const char * |
| 48 | SymbolFileSymtab::GetPluginDescriptionStatic() |
| 49 | { |
| 50 | return "Reads debug symbols from an object file's symbol table."; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | SymbolFile* |
| 55 | SymbolFileSymtab::CreateInstance (ObjectFile* obj_file) |
| 56 | { |
| 57 | return new SymbolFileSymtab(obj_file); |
| 58 | } |
| 59 | |
| 60 | SymbolFileSymtab::SymbolFileSymtab(ObjectFile* obj_file) : |
| 61 | SymbolFile(obj_file), |
| 62 | m_source_indexes(), |
| 63 | m_func_indexes(), |
| 64 | m_code_indexes(), |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 65 | m_objc_class_name_to_index () |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 66 | { |
| 67 | } |
| 68 | |
| 69 | SymbolFileSymtab::~SymbolFileSymtab() |
| 70 | { |
| 71 | } |
| 72 | |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 73 | ClangASTContext & |
| 74 | SymbolFileSymtab::GetClangASTContext () |
| 75 | { |
| 76 | ClangASTContext &ast = m_obj_file->GetModule()->GetClangASTContext(); |
| 77 | |
| 78 | return ast; |
| 79 | } |
| 80 | |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 81 | uint32_t |
| Sean Callanan | bfaf54d | 2011-12-03 04:38:43 +0000 | [diff] [blame] | 82 | SymbolFileSymtab::CalculateAbilities () |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 83 | { |
| 84 | uint32_t abilities = 0; |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 85 | if (m_obj_file) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 86 | { |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 87 | const Symtab *symtab = m_obj_file->GetSymtab(); |
| 88 | if (symtab) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 89 | { |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 90 | //---------------------------------------------------------------------- |
| 91 | // The snippet of code below will get the indexes the module symbol |
| 92 | // table entries that are code, data, or function related (debug info), |
| 93 | // sort them by value (address) and dump the sorted symbols. |
| 94 | //---------------------------------------------------------------------- |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 95 | if (symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile, m_source_indexes)) |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 96 | { |
| 97 | abilities |= CompileUnits; |
| 98 | } |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 99 | |
| 100 | if (symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugYes, Symtab::eVisibilityAny, m_func_indexes)) |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 101 | { |
| 102 | symtab->SortSymbolIndexesByValue(m_func_indexes, true); |
| 103 | abilities |= Functions; |
| 104 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 105 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 106 | if (symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny, m_code_indexes)) |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 107 | { |
| 108 | symtab->SortSymbolIndexesByValue(m_code_indexes, true); |
| 109 | abilities |= Labels; |
| 110 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 111 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 112 | if (symtab->AppendSymbolIndexesWithType(eSymbolTypeData, m_data_indexes)) |
| Greg Clayton | 5861d3e | 2011-06-19 04:02:02 +0000 | [diff] [blame] | 113 | { |
| 114 | symtab->SortSymbolIndexesByValue(m_data_indexes, true); |
| 115 | abilities |= GlobalVariables; |
| 116 | } |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 117 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 118 | lldb_private::Symtab::IndexCollection objc_class_indexes; |
| 119 | if (symtab->AppendSymbolIndexesWithType (eSymbolTypeObjCClass, objc_class_indexes)) |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 120 | { |
| 121 | abilities |= RuntimeTypes; |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 122 | symtab->AppendSymbolNamesToMap (objc_class_indexes, |
| 123 | true, |
| 124 | true, |
| 125 | m_objc_class_name_to_index); |
| 126 | m_objc_class_name_to_index.Sort(); |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 127 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 128 | } |
| 129 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 130 | return abilities; |
| 131 | } |
| 132 | |
| 133 | uint32_t |
| 134 | SymbolFileSymtab::GetNumCompileUnits() |
| 135 | { |
| 136 | // If we don't have any source file symbols we will just have one compile unit for |
| 137 | // the entire object file |
| 138 | if (m_source_indexes.empty()) |
| Jim Ingham | 969795f | 2011-09-21 01:17:13 +0000 | [diff] [blame] | 139 | return 0; |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 140 | |
| 141 | // If we have any source file symbols we will logically orgnize the object symbols |
| 142 | // using these. |
| 143 | return m_source_indexes.size(); |
| 144 | } |
| 145 | |
| 146 | CompUnitSP |
| 147 | SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) |
| 148 | { |
| 149 | CompUnitSP cu_sp; |
| 150 | |
| 151 | // If we don't have any source file symbols we will just have one compile unit for |
| 152 | // the entire object file |
| Jim Ingham | 969795f | 2011-09-21 01:17:13 +0000 | [diff] [blame] | 153 | // if (m_source_indexes.empty()) |
| 154 | // { |
| 155 | // const FileSpec &obj_file_spec = m_obj_file->GetFileSpec(); |
| 156 | // if (obj_file_spec) |
| 157 | // cu_sp.reset(new CompileUnit(m_obj_file->GetModule(), NULL, obj_file_spec, 0, eLanguageTypeUnknown)); |
| 158 | // |
| 159 | // } |
| 160 | /* else */ if (idx < m_source_indexes.size()) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 161 | { |
| 162 | const Symbol *cu_symbol = m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]); |
| 163 | if (cu_symbol) |
| Greg Clayton | 9e40956 | 2010-07-28 02:04:09 +0000 | [diff] [blame] | 164 | cu_sp.reset(new CompileUnit(m_obj_file->GetModule(), NULL, cu_symbol->GetMangled().GetName().AsCString(), 0, eLanguageTypeUnknown)); |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 165 | } |
| 166 | return cu_sp; |
| 167 | } |
| 168 | |
| 169 | size_t |
| 170 | SymbolFileSymtab::ParseCompileUnitFunctions (const SymbolContext &sc) |
| 171 | { |
| 172 | size_t num_added = 0; |
| 173 | // We must at least have a valid compile unit |
| 174 | assert (sc.comp_unit != NULL); |
| 175 | const Symtab *symtab = m_obj_file->GetSymtab(); |
| 176 | const Symbol *curr_symbol = NULL; |
| 177 | const Symbol *next_symbol = NULL; |
| 178 | // const char *prefix = m_obj_file->SymbolPrefix(); |
| 179 | // if (prefix == NULL) |
| 180 | // prefix == ""; |
| 181 | // |
| 182 | // const uint32_t prefix_len = strlen(prefix); |
| 183 | |
| 184 | // If we don't have any source file symbols we will just have one compile unit for |
| 185 | // the entire object file |
| 186 | if (m_source_indexes.empty()) |
| 187 | { |
| 188 | // The only time we will have a user ID of zero is when we don't have |
| 189 | // and source file symbols and we declare one compile unit for the |
| 190 | // entire object file |
| 191 | if (!m_func_indexes.empty()) |
| 192 | { |
| 193 | |
| 194 | } |
| 195 | |
| 196 | if (!m_code_indexes.empty()) |
| 197 | { |
| 198 | // StreamFile s(stdout); |
| 199 | // symtab->Dump(&s, m_code_indexes); |
| 200 | |
| 201 | uint32_t idx = 0; // Index into the indexes |
| 202 | const uint32_t num_indexes = m_code_indexes.size(); |
| 203 | for (idx = 0; idx < num_indexes; ++idx) |
| 204 | { |
| 205 | uint32_t symbol_idx = m_code_indexes[idx]; |
| 206 | curr_symbol = symtab->SymbolAtIndex(symbol_idx); |
| 207 | if (curr_symbol) |
| 208 | { |
| 209 | // Union of all ranges in the function DIE (if the function is discontiguous) |
| 210 | AddressRange func_range(curr_symbol->GetValue(), 0); |
| 211 | if (func_range.GetBaseAddress().IsSectionOffset()) |
| 212 | { |
| 213 | uint32_t symbol_size = curr_symbol->GetByteSize(); |
| 214 | if (symbol_size != 0 && !curr_symbol->GetSizeIsSibling()) |
| 215 | func_range.SetByteSize(symbol_size); |
| 216 | else if (idx + 1 < num_indexes) |
| 217 | { |
| 218 | next_symbol = symtab->SymbolAtIndex(m_code_indexes[idx + 1]); |
| 219 | if (next_symbol) |
| 220 | { |
| 221 | func_range.SetByteSize(next_symbol->GetValue().GetOffset() - curr_symbol->GetValue().GetOffset()); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | FunctionSP func_sp(new Function(sc.comp_unit, |
| 226 | symbol_idx, // UserID is the DIE offset |
| 227 | LLDB_INVALID_UID, // We don't have any type info for this function |
| 228 | curr_symbol->GetMangled(), // Linker/mangled name |
| 229 | NULL, // no return type for a code symbol... |
| 230 | func_range)); // first address range |
| 231 | |
| 232 | if (func_sp.get() != NULL) |
| 233 | { |
| 234 | sc.comp_unit->AddFunction(func_sp); |
| 235 | ++num_added; |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | } |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | // We assume we |
| 246 | } |
| 247 | return num_added; |
| 248 | } |
| 249 | |
| 250 | bool |
| 251 | SymbolFileSymtab::ParseCompileUnitLineTable (const SymbolContext &sc) |
| 252 | { |
| 253 | return false; |
| 254 | } |
| 255 | |
| 256 | bool |
| 257 | SymbolFileSymtab::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList &support_files) |
| 258 | { |
| 259 | return false; |
| 260 | } |
| 261 | |
| 262 | size_t |
| 263 | SymbolFileSymtab::ParseFunctionBlocks (const SymbolContext &sc) |
| 264 | { |
| 265 | return 0; |
| 266 | } |
| 267 | |
| 268 | |
| 269 | size_t |
| 270 | SymbolFileSymtab::ParseTypes (const SymbolContext &sc) |
| 271 | { |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | |
| 276 | size_t |
| 277 | SymbolFileSymtab::ParseVariablesForContext (const SymbolContext& sc) |
| 278 | { |
| 279 | return 0; |
| 280 | } |
| 281 | |
| 282 | Type* |
| 283 | SymbolFileSymtab::ResolveTypeUID(lldb::user_id_t type_uid) |
| 284 | { |
| 285 | return NULL; |
| 286 | } |
| 287 | |
| Greg Clayton | 1be10fc | 2010-09-29 01:12:09 +0000 | [diff] [blame] | 288 | lldb::clang_type_t |
| 289 | SymbolFileSymtab::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Type) |
| 290 | { |
| 291 | return NULL; |
| 292 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 293 | |
| Greg Clayton | 526e5af | 2010-11-13 03:52:47 +0000 | [diff] [blame] | 294 | ClangNamespaceDecl |
| Sean Callanan | 213fdb8 | 2011-10-13 01:49:10 +0000 | [diff] [blame] | 295 | SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl) |
| Greg Clayton | 96d7d74 | 2010-11-10 23:42:09 +0000 | [diff] [blame] | 296 | { |
| Greg Clayton | 526e5af | 2010-11-13 03:52:47 +0000 | [diff] [blame] | 297 | return ClangNamespaceDecl(); |
| Greg Clayton | 96d7d74 | 2010-11-10 23:42:09 +0000 | [diff] [blame] | 298 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 299 | |
| 300 | uint32_t |
| 301 | SymbolFileSymtab::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) |
| 302 | { |
| 303 | if (m_obj_file->GetSymtab() == NULL) |
| 304 | return 0; |
| 305 | |
| 306 | uint32_t resolved_flags = 0; |
| 307 | if (resolve_scope & eSymbolContextSymbol) |
| 308 | { |
| 309 | sc.symbol = m_obj_file->GetSymtab()->FindSymbolContainingFileAddress(so_addr.GetFileAddress()); |
| 310 | if (sc.symbol) |
| 311 | resolved_flags |= eSymbolContextSymbol; |
| 312 | } |
| 313 | return resolved_flags; |
| 314 | } |
| 315 | |
| 316 | uint32_t |
| 317 | SymbolFileSymtab::ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) |
| 318 | { |
| 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | uint32_t |
| Sean Callanan | 213fdb8 | 2011-10-13 01:49:10 +0000 | [diff] [blame] | 323 | SymbolFileSymtab::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 324 | { |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | uint32_t |
| 329 | SymbolFileSymtab::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) |
| 330 | { |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | uint32_t |
| Sean Callanan | 213fdb8 | 2011-10-13 01:49:10 +0000 | [diff] [blame] | 335 | SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 336 | { |
| 337 | Timer scoped_timer (__PRETTY_FUNCTION__, |
| 338 | "SymbolFileSymtab::FindFunctions (name = '%s')", |
| 339 | name.GetCString()); |
| Greg Clayton | 931180e | 2011-01-27 06:44:37 +0000 | [diff] [blame] | 340 | // If we ever support finding STABS or COFF debug info symbols, |
| 341 | // we will need to add support here. We are not trying to find symbols |
| 342 | // here, just "lldb_private::Function" objects that come from complete |
| 343 | // debug information. Any symbol queries should go through the symbol |
| 344 | // table itself in the module's object file. |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | uint32_t |
| 349 | SymbolFileSymtab::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) |
| 350 | { |
| 351 | Timer scoped_timer (__PRETTY_FUNCTION__, |
| 352 | "SymbolFileSymtab::FindFunctions (regex = '%s')", |
| 353 | regex.GetText()); |
| Greg Clayton | 931180e | 2011-01-27 06:44:37 +0000 | [diff] [blame] | 354 | // If we ever support finding STABS or COFF debug info symbols, |
| 355 | // we will need to add support here. We are not trying to find symbols |
| 356 | // here, just "lldb_private::Function" objects that come from complete |
| 357 | // debug information. Any symbol queries should go through the symbol |
| 358 | // table itself in the module's object file. |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 359 | return 0; |
| 360 | } |
| 361 | |
| Sean Callanan | 596ab8e | 2011-12-02 03:41:39 +0000 | [diff] [blame] | 362 | static int CountMethodArgs(const char *method_signature) |
| 363 | { |
| 364 | int num_args = 0; |
| 365 | |
| 366 | for (const char *colon_pos = strchr(method_signature, ':'); |
| 367 | colon_pos != NULL; |
| 368 | colon_pos = strchr(colon_pos + 1, ':')) |
| 369 | { |
| 370 | num_args++; |
| 371 | } |
| 372 | |
| 373 | return num_args; |
| 374 | } |
| 375 | |
| Greg Clayton | b0b9fe6 | 2010-08-03 00:35:52 +0000 | [diff] [blame] | 376 | uint32_t |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 377 | SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, |
| 378 | const lldb_private::ConstString &name, |
| 379 | const ClangNamespaceDecl *namespace_decl, |
| 380 | bool append, |
| 381 | uint32_t max_matches, |
| 382 | lldb_private::TypeList& types) |
| Greg Clayton | b0b9fe6 | 2010-08-03 00:35:52 +0000 | [diff] [blame] | 383 | { |
| 384 | if (!append) |
| 385 | types.Clear(); |
| Sean Callanan | 6c62c83 | 2011-12-08 02:08:40 +0000 | [diff] [blame] | 386 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 387 | if (!m_objc_class_name_to_index.IsEmpty()) |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 388 | { |
| Sean Callanan | 3ed3bca | 2011-12-02 18:06:45 +0000 | [diff] [blame] | 389 | TypeMap::iterator iter = m_objc_class_types.find(name); |
| Sean Callanan | 596ab8e | 2011-12-02 03:41:39 +0000 | [diff] [blame] | 390 | |
| 391 | if (iter != m_objc_class_types.end()) |
| 392 | { |
| 393 | types.Insert(iter->second); |
| 394 | return 1; |
| 395 | } |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 396 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 397 | const Symtab::NameToIndexMap::Entry *match = m_objc_class_name_to_index.FindFirstValueForName(name.GetCString()); |
| 398 | |
| 399 | if (match == NULL) |
| 400 | return 0; |
| 401 | |
| Sean Callanan | 6c62c83 | 2011-12-08 02:08:40 +0000 | [diff] [blame] | 402 | const bool isForwardDecl = false; |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 403 | const bool isInternal = true; |
| 404 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 405 | ClangASTContext &ast = GetClangASTContext(); |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 406 | |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 407 | lldb::clang_type_t objc_object_type = ast.CreateObjCClass (name.AsCString(), |
| 408 | ast.GetTranslationUnitDecl(), |
| 409 | isForwardDecl, |
| 410 | isInternal); |
| Sean Callanan | 596ab8e | 2011-12-02 03:41:39 +0000 | [diff] [blame] | 411 | |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 412 | Declaration decl; |
| 413 | |
| Greg Clayton | e1cd1be | 2012-01-29 20:56:30 +0000 | [diff] [blame^] | 414 | lldb::TypeSP type(new Type (match->value, |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 415 | this, |
| 416 | name, |
| Jim Ingham | 18f4629 | 2012-01-12 22:45:31 +0000 | [diff] [blame] | 417 | 0, // byte_size - don't change this from 0, we currently use that to identify these "synthetic" ObjC class types. |
| Greg Clayton | 1075aca | 2011-12-03 20:02:42 +0000 | [diff] [blame] | 418 | NULL, // SymbolContextScope* |
| 419 | 0, // encoding_uid |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 420 | Type::eEncodingInvalid, |
| 421 | decl, |
| 422 | objc_object_type, |
| Sean Callanan | 596ab8e | 2011-12-02 03:41:39 +0000 | [diff] [blame] | 423 | Type::eResolveStateFull)); |
| 424 | |
| Sean Callanan | 3ed3bca | 2011-12-02 18:06:45 +0000 | [diff] [blame] | 425 | m_objc_class_types[name] = type; |
| Sean Callanan | 09ab4b7 | 2011-11-30 22:11:59 +0000 | [diff] [blame] | 426 | |
| 427 | types.Insert(type); |
| 428 | |
| 429 | return 1; |
| 430 | } |
| Greg Clayton | b0b9fe6 | 2010-08-03 00:35:52 +0000 | [diff] [blame] | 431 | |
| 432 | return 0; |
| 433 | } |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 434 | // |
| 435 | //uint32_t |
| Greg Clayton | b0b9fe6 | 2010-08-03 00:35:52 +0000 | [diff] [blame] | 436 | //SymbolFileSymtab::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) |
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 437 | //{ |
| 438 | // return 0; |
| 439 | //} |
| 440 | |
| 441 | |
| 442 | //------------------------------------------------------------------ |
| 443 | // PluginInterface protocol |
| 444 | //------------------------------------------------------------------ |
| 445 | const char * |
| 446 | SymbolFileSymtab::GetPluginName() |
| 447 | { |
| 448 | return "SymbolFileSymtab"; |
| 449 | } |
| 450 | |
| 451 | const char * |
| 452 | SymbolFileSymtab::GetShortPluginName() |
| 453 | { |
| 454 | return GetPluginNameStatic(); |
| 455 | } |
| 456 | |
| 457 | uint32_t |
| 458 | SymbolFileSymtab::GetPluginVersion() |
| 459 | { |
| 460 | return 1; |
| 461 | } |