diff options
author | Greg Clayton <gclayton@apple.com> | 2012-12-05 21:24:42 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-12-05 21:24:42 +0000 |
commit | b43165b7a5d59d8178dc803ec0351d3a62a38946 (patch) | |
tree | 53a13b3531ea6dcbc86f6ebac6f06e5f1ef7398f /lldb/source/API/SBModule.cpp | |
parent | 0a471ea66c3c1b6b9183987cb4248af2ca216164 (diff) | |
download | bcm5719-llvm-b43165b7a5d59d8178dc803ec0351d3a62a38946.tar.gz bcm5719-llvm-b43165b7a5d59d8178dc803ec0351d3a62a38946.zip |
<rdar://problem/12749733>
Always allows getting builtin types by name even if there is no backing debug information.
llvm-svn: 169424
Diffstat (limited to 'lldb/source/API/SBModule.cpp')
-rw-r--r-- | lldb/source/API/SBModule.cpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index 933e803c270..f0c916ea048 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -488,27 +488,29 @@ SBModule::FindFirstType (const char *name_cstr) if (name_cstr && module_sp) { SymbolContext sc; - TypeList type_list; - uint32_t num_matches = 0; const bool exact_match = false; ConstString name(name_cstr); - num_matches = module_sp->FindTypes (sc, - name, - exact_match, - 1, - type_list); + sb_type = SBType (module_sp->FindFirstType(sc, name, exact_match)); - if (num_matches) - sb_type = lldb::SBType(type_list.GetTypeAtIndex(0)); + if (!sb_type.IsValid()) + sb_type = SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name)); } return sb_type; } +lldb::SBType +SBModule::GetBasicType(lldb::BasicType type) +{ + ModuleSP module_sp (GetSP ()); + if (module_sp) + return SBType (ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), type)); + return SBType(); +} + lldb::SBTypeList SBModule::FindTypes (const char *type) { - SBTypeList retval; ModuleSP module_sp (GetSP ()); @@ -517,20 +519,27 @@ SBModule::FindTypes (const char *type) SymbolContext sc; TypeList type_list; const bool exact_match = false; - uint32_t num_matches = 0; ConstString name(type); + const uint32_t num_matches = module_sp->FindTypes (sc, + name, + exact_match, + UINT32_MAX, + type_list); - num_matches = module_sp->FindTypes (sc, - name, - exact_match, - UINT32_MAX, - type_list); - - for (size_t idx = 0; idx < num_matches; idx++) + if (num_matches > 0) + { + for (size_t idx = 0; idx < num_matches; idx++) + { + TypeSP type_sp (type_list.GetTypeAtIndex(idx)); + if (type_sp) + retval.Append(SBType(type_sp)); + } + } + else { - TypeSP type_sp (type_list.GetTypeAtIndex(idx)); - if (type_sp) - retval.Append(SBType(type_sp)); + SBType sb_type(ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name)); + if (sb_type.IsValid()) + retval.Append(sb_type); } } |