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


C++ ASTContext::getObjCClassType方法代码示例

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


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

示例1: QualType

clang::QualType
AppleObjCTypeEncodingParser::BuildType (clang::ASTContext &ast_ctx, StringLexer& type, bool for_expression, uint32_t *bitfield_bit_size)
{
    if (!type.HasAtLeast(1))
        return clang::QualType();
    
    switch (type.Peek())
    {
    default:
        break;
    case '{':
        return BuildStruct(ast_ctx, type, for_expression);
    case '[':
        return BuildArray(ast_ctx, type, for_expression);
    case '(':
        return BuildUnion(ast_ctx, type, for_expression);
    case '@':
        return BuildObjCObjectPointerType(ast_ctx, type, for_expression);
    }
    
    switch (type.Next())
    {
    default:
        type.PutBack(1);
        return clang::QualType();
    case 'c':
        return ast_ctx.CharTy;
    case 'i':
        return ast_ctx.IntTy;
    case 's':
        return ast_ctx.ShortTy;
    case 'l':
        return ast_ctx.getIntTypeForBitwidth(32, true);
        // this used to be done like this:
        //   ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
        //   if (!lldb_ctx)
        //      return clang::QualType();
        //   return lldb_ctx->GetIntTypeFromBitSize(32, true).GetQualType();
        // which uses one of the constants if one is available, but we don't think all this work is necessary.
    case 'q':
        return ast_ctx.LongLongTy;
    case 'C':
        return ast_ctx.UnsignedCharTy;
    case 'I':
        return ast_ctx.UnsignedIntTy;
    case 'S':
        return ast_ctx.UnsignedShortTy;
    case 'L':
        return ast_ctx.getIntTypeForBitwidth(32, false);
        // see note for 'l'
    case 'Q':
        return ast_ctx.UnsignedLongLongTy;
    case 'f':
        return ast_ctx.FloatTy;
    case 'd':
        return ast_ctx.DoubleTy;
    case 'B':
        return ast_ctx.BoolTy;
    case 'v':
        return ast_ctx.VoidTy;
    case '*':
        return ast_ctx.getPointerType(ast_ctx.CharTy);
    case '#':
        return ast_ctx.getObjCClassType();
    case ':':
        return ast_ctx.getObjCSelType();
    case 'b':
        {
            uint32_t size = ReadNumber(type);
            if (bitfield_bit_size)
            {
                *bitfield_bit_size = size;
                return ast_ctx.UnsignedIntTy; // FIXME: the spec is fairly vague here.
            }
            else
                return clang::QualType();
        }
    case 'r':
        {
            clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
            if (target_type.isNull())
                return clang::QualType();
            else if (target_type == ast_ctx.UnknownAnyTy)
                return ast_ctx.UnknownAnyTy;
            else
                return ast_ctx.getConstType(target_type);
        }
    case '^':
        {
            if (!for_expression && type.NextIf('?'))
            {
                // if we are not supporting the concept of unknownAny, but what is being created here is an unknownAny*, then
                // we can just get away with a void*
                // this is theoretically wrong (in the same sense as 'theoretically nothing exists') but is way better than outright failure
                // in many practical cases
                return ast_ctx.VoidPtrTy;
            }
            else
            {
                clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
//.........这里部分代码省略.........
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:101,代码来源:AppleObjCTypeEncodingParser.cpp


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