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


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

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


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

示例1: DecodeTypeFromStr


//.........这里部分代码省略.........
  case 'i':
    if (HowLong == 3)
      Type = Unsigned ? Context.UnsignedInt128Ty : Context.Int128Ty;
    else if (HowLong == 2)
      Type = Unsigned ? Context.UnsignedLongLongTy : Context.LongLongTy;
    else if (HowLong == 1)
      Type = Unsigned ? Context.UnsignedLongTy : Context.LongTy;
    else
      Type = Unsigned ? Context.UnsignedIntTy : Context.IntTy;
    break;
  case 'c':
    assert(HowLong == 0 && "Bad modifiers used with 'c'!");
    if (Signed)
      Type = Context.SignedCharTy;
    else if (Unsigned)
      Type = Context.UnsignedCharTy;
    else
      Type = Context.CharTy;
    break;
  case 'b': // boolean
    assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'b'!");
    Type = Context.BoolTy;
    break;
  case 'z':  // size_t.
    assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'z'!");
    Type = Context.getSizeType();
    break;
  case 'F':
    Type = Context.getCFConstantStringType();
    break;
  case 'a':
    Type = Context.getBuiltinVaListType();
    assert(!Type.isNull() && "builtin va list type not initialized!");
    break;
  case 'A':
    // This is a "reference" to a va_list; however, what exactly
    // this means depends on how va_list is defined. There are two
    // different kinds of va_list: ones passed by value, and ones
    // passed by reference.  An example of a by-value va_list is
    // x86, where va_list is a char*. An example of by-ref va_list
    // is x86-64, where va_list is a __va_list_tag[1]. For x86,
    // we want this argument to be a char*&; for x86-64, we want
    // it to be a __va_list_tag*.
    Type = Context.getBuiltinVaListType();
    assert(!Type.isNull() && "builtin va list type not initialized!");
    if (Type->isArrayType()) {
      Type = Context.getArrayDecayedType(Type);
    } else {
      Type = Context.getLValueReferenceType(Type);
    }
    break;
  case 'V': {
    char *End;
    
    unsigned NumElements = strtoul(Str, &End, 10);
    assert(End != Str && "Missing vector size");
    
    Str = End;
    
    QualType ElementType = DecodeTypeFromStr(Str, Context, Error, false);
    Type = Context.getVectorType(ElementType, NumElements);
    break;
  }
  case 'P': {
    IdentifierInfo *II = &Context.Idents.get("FILE");
    DeclContext::lookup_result Lookup 
      = Context.getTranslationUnitDecl()->lookup(Context, II);
    if (Lookup.first != Lookup.second && isa<TypeDecl>(*Lookup.first)) {
      Type = Context.getTypeDeclType(cast<TypeDecl>(*Lookup.first));
      break;
    }
    else {
      Error = Builtin::Context::GE_Missing_FILE;
      return QualType();
    }
  }
  }
  
  if (!AllowTypeModifiers)
    return Type;
  
  Done = false;
  while (!Done) {
    switch (*Str++) {
      default: Done = true; --Str; break;
      case '*':
        Type = Context.getPointerType(Type);
        break;
      case '&':
        Type = Context.getLValueReferenceType(Type);
        break;
      // FIXME: There's no way to have a built-in with an rvalue ref arg.
      case 'C':
        Type = Type.getQualifiedType(QualType::Const);
        break;
    }
  }
  
  return Type;
}
开发者ID:blickly,项目名称:llvm-clang-PRETC,代码行数:101,代码来源:Builtins.cpp

示例2: DecodeTypeFromStr


//.........这里部分代码省略.........
    //Ty = Context.getObjCSelType();
    break;
  case 'a':
    //Ty = Context.getBuiltinVaListType();
    //assert(!Ty.isNull() && "builtin va list type not initialized!");
    break;
  case 'A':
    // This is a "reference" to a va_list; however, what exactly
    // this means depends on how va_list is defined. There are two
    // different kinds of va_list: ones passed by value, and ones
    // passed by reference.  An example of a by-value va_list is
    // x86, where va_list is a char*. An example of by-ref va_list
    // is x86-64, where va_list is a __va_list_tag[1]. For x86,
    // we want this argument to be a char*&; for x86-64, we want
    // it to be a __va_list_tag*.
//    Ty = Context.getBuiltinVaListType();
//    assert(!Ty.isNull() && "builtin va list type not initialized!");
//    if (Ty->isArrayType())
//      Ty = Context.getArrayDecayedType(Ty);
//    else
//      Ty = Context.getLValueReferenceType(Ty);
    break;
  case 'V': {
    char *End;
    unsigned NumElements = strtoul(Str, &End, 10);
    assert(End != Str && "Missing vector size");
    Str = End;

    Type ElementType = DecodeTypeFromStr(Str, Context, Error,
                                             RequiresICE, false);
    assert(!RequiresICE && "Can't require vector ICE");

    // TODO: No way to make AltiVec vectors in builtins yet.
    Ty = Context.getVectorType(ElementType, NumElements,
    		VectorType::GenericVector, true);
    break;
  }
  case 'X': {
    Type ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE,
                                             false);
    assert(!RequiresICE && "Can't require complex ICE");
//    Ty = Context.getComplexType(ElementType);
    break;
  }
  case 'P':
 //   Ty = Context.getFILEType();
//    if (Ty.isNull()) {
//      Error = ASTContext::GE_Missing_stdio;
      return Type();
//    }
//    break;
  case 'J':
//    if (Signed)
//      Ty = Context.getsigjmp_bufType();
//    else
//      Ty = Context.getjmp_bufType();

    if (Ty.isNull()) {
      Error = ASTContext::GE_Missing_setjmp;
      return Type();
    }
    break;
  }

  // If there are modifiers and if we're allowed to parse them, go for it.
  Done = !AllowTypeModifiers;
开发者ID:YabinHu,项目名称:mlang,代码行数:67,代码来源:ASTContext.cpp


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