<rdar://problem/12749733>
Always allows getting builtin types by name even if there is no backing debug information.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169424 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index 933e803..f0c916e 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -488,27 +488,29 @@
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 @@
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)
{
- TypeSP type_sp (type_list.GetTypeAtIndex(idx));
- if (type_sp)
- retval.Append(SBType(type_sp));
+ 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
+ {
+ SBType sb_type(ClangASTType::GetBasicType (module_sp->GetClangASTContext().getASTContext(), name));
+ if (sb_type.IsValid())
+ retval.Append(sb_type);
}
}