本文整理汇总了C++中TypeList::GetTypeAtIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeList::GetTypeAtIndex方法的具体用法?C++ TypeList::GetTypeAtIndex怎么用?C++ TypeList::GetTypeAtIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeList
的用法示例。
在下文中一共展示了TypeList::GetTypeAtIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: complete_type_sp
lldb::TypeSP
ObjCLanguageRuntime::LookupInCompleteClassCache(ConstString &name) {
CompleteClassMap::iterator complete_class_iter =
m_complete_class_cache.find(name);
if (complete_class_iter != m_complete_class_cache.end()) {
// Check the weak pointer to make sure the type hasn't been unloaded
TypeSP complete_type_sp(complete_class_iter->second.lock());
if (complete_type_sp)
return complete_type_sp;
else
m_complete_class_cache.erase(name);
}
if (m_negative_complete_class_cache.count(name) > 0)
return TypeSP();
const ModuleList &modules = m_process->GetTarget().GetImages();
SymbolContextList sc_list;
const size_t matching_symbols =
modules.FindSymbolsWithNameAndType(name, eSymbolTypeObjCClass, sc_list);
if (matching_symbols) {
SymbolContext sc;
sc_list.GetContextAtIndex(0, sc);
ModuleSP module_sp(sc.module_sp);
if (!module_sp)
return TypeSP();
const SymbolContext null_sc;
const bool exact_match = true;
const uint32_t max_matches = UINT32_MAX;
TypeList types;
llvm::DenseSet<SymbolFile *> searched_symbol_files;
const uint32_t num_types = module_sp->FindTypes(
null_sc, name, exact_match, max_matches, searched_symbol_files, types);
if (num_types) {
uint32_t i;
for (i = 0; i < num_types; ++i) {
TypeSP type_sp(types.GetTypeAtIndex(i));
if (ClangASTContext::IsObjCObjectOrInterfaceType(
type_sp->GetForwardCompilerType())) {
if (type_sp->IsCompleteObjCClass()) {
m_complete_class_cache[name] = type_sp;
return type_sp;
}
}
}
}
}
m_negative_complete_class_cache.insert(name);
return TypeSP();
}