当前位置: 首页>>代码示例>>C++>>正文


C++ TypeList::Types方法代码示例

本文整理汇总了C++中TypeList::Types方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeList::Types方法的具体用法?C++ TypeList::Types怎么用?C++ TypeList::Types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeList的用法示例。


在下文中一共展示了TypeList::Types方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Find_Impl

 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
                ResultSet &results) override {
   bool result = false;
   
   Target *target = exe_scope->CalculateTarget().get();
   if (target) {
     const auto &images(target->GetImages());
     SymbolContext null_sc;
     ConstString cs_key(key);
     llvm::DenseSet<SymbolFile*> searched_sym_files;
     TypeList matches;
     images.FindTypes(null_sc,
                      cs_key,
                      false,
                      UINT32_MAX,
                      searched_sym_files,
                      matches);
     for (const auto& match : matches.Types()) {
       if (match.get()) {
         CompilerType compiler_type(match->GetFullCompilerType());
         LanguageType lang_type(compiler_type.GetMinimumLanguage());
         // other plugins will find types for other languages - here we only do C and C++
         if (!Language::LanguageIsC(lang_type) && !Language::LanguageIsCPlusPlus(lang_type))
           continue;
         if (compiler_type.IsTypedefType())
           compiler_type = compiler_type.GetTypedefedType();
         std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
                                                                 new CPlusPlusTypeScavengerResult(compiler_type));
         results.insert(std::move(scavengeresult));
         result = true;
       }
     }
   }
   
   return result;
 }
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:36,代码来源:CPlusPlusLanguage.cpp

示例2: exe_ctx

bool
TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
                                       std::string& dest) const
{
    dest.clear();
    if (!valobj)
        return false;
    if (!valobj->CanProvideValue())
        return false;
    ProcessSP process_sp;
    TargetSP target_sp;
    void* valobj_key = (process_sp = valobj->GetProcessSP()).get();
    if (!valobj_key)
        valobj_key = (target_sp = valobj->GetTargetSP()).get();
    else
        target_sp = process_sp->GetTarget().shared_from_this();
    if (!valobj_key)
        return false;
    auto iter = m_types.find(valobj_key),
    end = m_types.end();
    CompilerType valobj_enum_type;
    if (iter == end)
    {
        // probably a redundant check
        if (!target_sp)
            return false;
        const ModuleList& images(target_sp->GetImages());
        SymbolContext sc;
        TypeList types;
        images.FindTypes(sc, m_enum_type, false, UINT32_MAX, types);
        if (types.GetSize() == 0)
            return false;
        for (lldb::TypeSP type_sp : types.Types())
        {
            if (!type_sp)
                continue;
            if ( (type_sp->GetForwardCompilerType().GetTypeInfo() & eTypeIsEnumeration) == eTypeIsEnumeration)
            {
                valobj_enum_type = type_sp->GetFullCompilerType ();
                m_types.emplace(valobj_key,valobj_enum_type);
                break;
            }
        }
    }
    else
        valobj_enum_type = iter->second;
    if (valobj_enum_type.IsValid() == false)
        return false;
    DataExtractor data;
    Error error;
    valobj->GetData(data, error);
    if (error.Fail())
        return false;
    ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
    StreamString sstr;
    valobj_enum_type.DumpTypeValue(&sstr,
                                   lldb::eFormatEnum,
                                   data,
                                   0,
                                   data.GetByteSize(),
                                   0,
                                   0,
                                   exe_ctx.GetBestExecutionContextScope());
    if (!sstr.GetString().empty())
        dest.swap(sstr.GetString());
    return !dest.empty();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:67,代码来源:TypeFormat.cpp


注:本文中的TypeList::Types方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。