• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TypeVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assert

CallerInstrumentation* CallerInstrumentation::Build(
  LLVMContext &Context, Module &M, StringRef FnName,
  FunctionEvent::Direction Dir)
{
  Function *Fn = M.getFunction(FnName);
  if (Fn == NULL) return NULL;

  // Instrumentation functions do not return.
  Type *VoidTy = Type::getVoidTy(Context);

  // Get the argument types of the function to be instrumented.
  TypeVector ArgTypes;
  for (auto &Arg : Fn->getArgumentList()) ArgTypes.push_back(Arg.getType());

  // Declare or retrieve instrumentation functions.
  string Name = (CALLER_ENTER + FnName).str();
  auto InstrType = FunctionType::get(VoidTy, ArgTypes, Fn->isVarArg());
  Function *Call = cast<Function>(M.getOrInsertFunction(Name, InstrType));
  assert(Call != NULL);

  // Instrumentation of returns must include the returned value...
  TypeVector RetTypes(ArgTypes);
  if (!Fn->getReturnType()->isVoidTy())
    RetTypes.push_back(Fn->getReturnType());

  Name = (CALLER_LEAVE + FnName).str();
  InstrType = FunctionType::get(VoidTy, RetTypes, Fn->isVarArg());
  Function *Return = cast<Function>(M.getOrInsertFunction(Name, InstrType));
  assert(Return != NULL);

  return new CallerInstrumentation(Call, Return, Dir);
}
开发者ID:dansanduleac,项目名称:TESLA,代码行数:32,代码来源:Caller.cpp


示例2: displayOpenTag

void
herschel::xml::displayTypeVector(Port<Octet>& port, zstring tagName, const TypeVector& types)
{
  if (!types.empty()) {
    displayOpenTag(port, tagName);
    for (size_t i = 0; i < types.size(); i++)
      herschel::display(port, types[i].toString());
    displayCloseTag(port, tagName);
  }
}
开发者ID:hvellyr,项目名称:herschel,代码行数:10,代码来源:xmlout.cpp


示例3:

bool
FunctionType::isLike (TypeVector arguments, Type* return_type)
{
   if (_return_type != return_type) return false;
   if (_arguments.size() != arguments.size()) return false;

   for (size_t i = 0; i < arguments.size(); ++i)
   {
      if (arguments[i] != _arguments[i]) return false;
   }
   return true;
}
开发者ID:ThQ,项目名称:memc,代码行数:12,代码来源:FunctionType.cpp


示例4: equal

static bool equal(const TypeVector& l, const TypeVector& r) {
  if (&l == &r)
    return true;
  if (l.size() != r.size())
    return false;
  TypeVector::const_iterator itl = l.begin(), itr = r.begin(),
  endl = l.end();
  while (itl != endl) {
    if (!(*itl)->equals(*itr))
      return false;
    ++itl;
    ++itr;
  }
  return true;
}
开发者ID:KhronosGroup,项目名称:SPIR-Tools,代码行数:15,代码来源:FunctionDescriptor.cpp


示例5:

bool
TupleType::hasTypes (TypeVector tys)
{
   if (_subtypes.size() == tys.size())
   {
      for (size_t i = 0; i < tys.size(); ++i)
      {
         if (_subtypes[i] != tys[i])
         {
            return false;
         }
      }
      return true;
   }
   return false;
}
开发者ID:ThQ,项目名称:memc,代码行数:16,代码来源:TupleType.cpp


示例6: addArgument

void
FunctionType::addArguments (TypeVector tys)
{
   for (size_t i = 0; i < tys.size(); ++i)
   {
      addArgument(tys[i]);
   }
}
开发者ID:ThQ,项目名称:memc,代码行数:8,代码来源:FunctionType.cpp


示例7: addChild

bool
TupleType::addTypes (TypeVector tys)
{
   for (size_t i = 0; i < tys.size(); ++i)
   {
      addChild(tys[i]);
   }
   _recomputeName();
   return true;
}
开发者ID:ThQ,项目名称:memc,代码行数:10,代码来源:TupleType.cpp


示例8: DtoType

ldc::DIType ldc::DIBuilder::CreateVectorType(Type *type) {
  LLType *T = DtoType(type);
  Type *t = type->toBasetype();

  assert(t->ty == Tvector &&
         "Only vectors allowed for debug info in DIBuilder::CreateVectorType");
  TypeVector *tv = static_cast<TypeVector *>(t);
  Type *te = tv->elementType();
  // translate void vectors to byte vectors
  if (te->toBasetype()->ty == Tvoid)
    te = Type::tuns8;
  int64_t Dim = tv->size(Loc()) / te->size(Loc());
  LLMetadata *subscripts[] = {DBuilder.getOrCreateSubrange(0, Dim)};

  return DBuilder.createVectorType(
      getTypeAllocSize(T) * 8,              // size (bits)
      getABITypeAlign(T) * 8,               // align (bits)
      CreateTypeDescription(te, false),     // element type
      DBuilder.getOrCreateArray(subscripts) // subscripts
      );
}
开发者ID:John-Colvin,项目名称:ldc,代码行数:21,代码来源:dibuilder.cpp


示例9: DtoType

llvm::DIType ldc::DIBuilder::CreateVectorType(Type *type)
{
    LLType* T = DtoType(type);
    Type* t = type->toBasetype();

    assert(t->ty == Tvector && "Only vectors allowed for debug info in DIBuilder::CreateVectorType");
    TypeVector *tv = static_cast<TypeVector *>(t);
    Type *te = tv->elementType();
    int64_t Dim = tv->size(Loc()) / te->size(Loc());
    llvm::Value *subscripts[] =
    {
        DBuilder.getOrCreateSubrange(0, Dim)
    };
    llvm::DIType basetype = CreateTypeDescription(te, NULL);

    return DBuilder.createVectorType(
        getTypeBitSize(T), // size (bits)
        getABITypeAlign(T)*8, // align (bits)
        basetype, // element type
        DBuilder.getOrCreateArray(subscripts) // subscripts
    );
}
开发者ID:Safety0ff,项目名称:ldc,代码行数:22,代码来源:dibuilder.cpp


示例10: match_types

// The scalar cases in llsd_matches() use this helper. In most cases, we can
// accept not only the exact type specified in the prototype, but also other
// types convertible to the expected type. That implies looping over an array
// of such types. If the actual type doesn't match any of them, we want to
// provide a list of acceptable conversions as well as the exact type, e.g.:
// "Integer (or Boolean, Real, String) required instead of UUID". Both the
// implementation and the calling logic are simplified by separating out the
// expected type from the convertible types.
static std::string match_types(LLSD::Type expect, // prototype.type()
                               const TypeVector& accept, // types convertible to that type
                               LLSD::Type actual,        // type we're checking
                               const std::string& pfx)   // as for llsd_matches
{
    // Trivial case: if the actual type is exactly what we expect, we're good.
    if (actual == expect)
        return "";

    // For the rest of the logic, build up a suitable error string as we go so
    // we only have to make a single pass over the list of acceptable types.
    // If we detect success along the way, we'll simply discard the partial
    // error string.
    std::ostringstream out;
    out << colon(pfx) << sTypes.lookup(expect);

    // If there are any convertible types, append that list.
    if (! accept.empty())
    {
        out << " (";
        const char* sep = "or ";
        for (TypeVector::const_iterator ai(accept.begin()), aend(accept.end());
             ai != aend; ++ai, sep = ", ")
        {
            // Don't forget to return success if we match any of those types...
            if (actual == *ai)
                return "";
            out << sep << sTypes.lookup(*ai);
        }
        out << ')';
    }
    // If we got this far, it's because 'actual' was not one of the acceptable
    // types, so we must return an error. 'out' already contains colon(pfx)
    // and the formatted list of acceptable types, so just append the mismatch
    // phrase and the actual type.
    out << op << sTypes.lookup(actual);
    return out.str();
}
开发者ID:NanaYngvarrdottir,项目名称:Virtual-Reality-Viewer-3,代码行数:46,代码来源:llsdutil.cpp


示例11: build_class_scope

void RenameClassesPass::run_pass(DexClassesVector& dexen, ConfigFiles& cfg) {
  auto scope = build_class_scope(dexen);
  std::unordered_set<const DexType*> untouchables;
  for (const auto& base : m_untouchable_hierarchies) {
    auto base_type = DexType::get_type(base.c_str());
    if (base_type != nullptr) {
      untouchables.insert(base_type);
      TypeVector children;
      get_all_children(base_type, children);
      untouchables.insert(children.begin(), children.end());
    }
  }
  rename_classes(
      scope, m_pre_filter_whitelist, m_post_filter_whitelist, m_path,
      untouchables, cfg.get_proguard_map(), m_rename_annotations);
  TRACE(RENAME, 1,
      "renamed classes: %d anon classes, %d from single char patterns, "
      "%d from multi char patterns\n",
      match_inner,
      match_short,
      match_long);
  TRACE(RENAME, 1, "String savings, at least %d bytes \n",
      base_strings_size - ren_strings_size);
}
开发者ID:476139183,项目名称:redex,代码行数:24,代码来源:RenameClasses.cpp


示例12: printf

MATCH ArrayLiteralExp::implicitConvTo(Type *t)
{   MATCH result = MATCHexact;

#if 0
    printf("ArrayLiteralExp::implicitConvTo(this=%s, type=%s, t=%s)\n",
        toChars(), type->toChars(), t->toChars());
#endif
    Type *typeb = type->toBasetype();
    Type *tb = t->toBasetype();
    if ((tb->ty == Tarray || tb->ty == Tsarray) &&
        (typeb->ty == Tarray || typeb->ty == Tsarray))
    {
        if (tb->ty == Tsarray)
        {   TypeSArray *tsa = (TypeSArray *)tb;
            if (elements->dim != tsa->dim->toInteger())
                result = MATCHnomatch;
        }

        if (!elements->dim && typeb->nextOf()->toBasetype()->ty != Tvoid)
            result = MATCHnomatch;

        Type *telement = tb->nextOf();
        for (size_t i = 0; i < elements->dim; i++)
        {   Expression *e = (*elements)[i];
            if (result == MATCHnomatch)
                break;                          // no need to check for worse
            MATCH m = (MATCH)e->implicitConvTo(telement);
            if (m < result)
                result = m;                     // remember worst match
        }

        if (!result)
            result = type->implicitConvTo(t);

        return result;
    }
#if DMDV2
    else if (tb->ty == Tvector &&
        (typeb->ty == Tarray || typeb->ty == Tsarray))
    {
        // Convert array literal to vector type
        TypeVector *tv = (TypeVector *)tb;
        TypeSArray *tbase = (TypeSArray *)tv->basetype;
        assert(tbase->ty == Tsarray);
        if (elements->dim != tbase->dim->toInteger())
            return MATCHnomatch;

        Type *telement = tv->elementType();
        for (size_t i = 0; i < elements->dim; i++)
        {   Expression *e = (*elements)[i];
            MATCH m = (MATCH)e->implicitConvTo(telement);
            if (m < result)
                result = m;                     // remember worst match
            if (result == MATCHnomatch)
                break;                          // no need to check for worse
        }
        return result;
    }
#endif
    else
        return Expression::implicitConvTo(t);
}
开发者ID:NilsBossung,项目名称:ldc,代码行数:62,代码来源:cast.c


示例13: switch

unsigned Type::totym()
{   unsigned t;

    switch (ty)
    {
        case Tvoid:     t = TYvoid;     break;
        case Tint8:     t = TYschar;    break;
        case Tuns8:     t = TYuchar;    break;
        case Tint16:    t = TYshort;    break;
        case Tuns16:    t = TYushort;   break;
        case Tint32:    t = TYint;      break;
        case Tuns32:    t = TYuint;     break;
        case Tint64:    t = TYllong;    break;
        case Tuns64:    t = TYullong;   break;
        case Tfloat32:  t = TYfloat;    break;
        case Tfloat64:  t = TYdouble;   break;
        case Tfloat80:  t = TYldouble;  break;
        case Timaginary32: t = TYifloat; break;
        case Timaginary64: t = TYidouble; break;
        case Timaginary80: t = TYildouble; break;
        case Tcomplex32: t = TYcfloat;  break;
        case Tcomplex64: t = TYcdouble; break;
        case Tcomplex80: t = TYcldouble; break;
        case Tbool:     t = TYbool;     break;
        case Tchar:     t = TYchar;     break;
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
        case Twchar:    t = TYwchar_t;  break;
        case Tdchar:    t = TYdchar;    break;
#else
        case Twchar:    t = TYwchar_t;  break;
        case Tdchar:
                t = (global.params.symdebug == 1) ? TYdchar : TYulong;
                break;
#endif

        case Taarray:   t = TYaarray;   break;
        case Tclass:
        case Treference:
        case Tpointer:  t = TYnptr;     break;
        case Tdelegate: t = TYdelegate; break;
        case Tarray:    t = TYdarray;   break;
#if SARRAYVALUE
        case Tsarray:   t = TYstruct;   break;
#else
        case Tsarray:   t = TYarray;    break;
#endif
        case Tstruct:   t = TYstruct;   break;

        case Tenum:
        case Ttypedef:
             t = toBasetype()->totym();
             break;

        case Tident:
        case Ttypeof:
            error(0, "forward reference of %s", toChars());
            t = TYint;
            break;

        case Tnull:
            t = TYnptr;
            break;

        case Tvector:
        {   TypeVector *tv = (TypeVector *)this;
            TypeBasic *tb = tv->elementType();
            switch (tb->ty)
            {   case Tvoid:
                case Tint8:     t = TYschar16;  break;
                case Tuns8:     t = TYuchar16;  break;
                case Tint16:    t = TYshort8;   break;
                case Tuns16:    t = TYushort8;  break;
                case Tint32:    t = TYlong4;    break;
                case Tuns32:    t = TYulong4;   break;
                case Tint64:    t = TYllong2;   break;
                case Tuns64:    t = TYullong2;  break;
                case Tfloat32:  t = TYfloat4;   break;
                case Tfloat64:  t = TYdouble2;  break;
                default:
                    assert(0);
                    break;
            }
            if (tv->size(0) == 32)
                error(0, "AVX vector types not supported");
            break;
        }

        default:
#ifdef DEBUG
            printf("ty = %d, '%s'\n", ty, toChars());
            halt();
#endif
            assert(0);
    }

#if DMDV2
    // Add modifiers
    switch (mod)
    {
        case 0:
//.........这里部分代码省略.........
开发者ID:iteratif,项目名称:dmd,代码行数:101,代码来源:glue.c


示例14: totym

unsigned totym(Type *tx)
{
    unsigned t;
    switch (tx->ty)
    {
        case Tvoid:     t = TYvoid;     break;
        case Tint8:     t = TYschar;    break;
        case Tuns8:     t = TYuchar;    break;
        case Tint16:    t = TYshort;    break;
        case Tuns16:    t = TYushort;   break;
        case Tint32:    t = TYint;      break;
        case Tuns32:    t = TYuint;     break;
        case Tint64:    t = TYllong;    break;
        case Tuns64:    t = TYullong;   break;
        case Tfloat32:  t = TYfloat;    break;
        case Tfloat64:  t = TYdouble;   break;
        case Tfloat80:  t = TYldouble;  break;
        case Timaginary32: t = TYifloat; break;
        case Timaginary64: t = TYidouble; break;
        case Timaginary80: t = TYildouble; break;
        case Tcomplex32: t = TYcfloat;  break;
        case Tcomplex64: t = TYcdouble; break;
        case Tcomplex80: t = TYcldouble; break;
        case Tbool:     t = TYbool;     break;
        case Tchar:     t = TYchar;     break;
        case Twchar:    t = TYwchar_t;  break;
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
        case Tdchar:    t = TYdchar;    break;
#else
        case Tdchar:
            t = (global.params.symdebug == 1) ? TYdchar : TYulong;
            break;
#endif

        case Taarray:   t = TYaarray;   break;
        case Tclass:
        case Treference:
        case Tpointer:  t = TYnptr;     break;
        case Tdelegate: t = TYdelegate; break;
        case Tarray:    t = TYdarray;   break;
        case Tsarray:   t = TYstruct;   break;

        case Tstruct:
            t = TYstruct;
            if (tx->toDsymbol(NULL)->ident == Id::__c_long_double)
                t = TYdouble;
            break;

        case Tenum:
            t = totym(tx->toBasetype());
            break;

        case Tident:
        case Ttypeof:
#ifdef DEBUG
            printf("ty = %d, '%s'\n", tx->ty, tx->toChars());
#endif
            error(Loc(), "forward reference of %s", tx->toChars());
            t = TYint;
            break;

        case Tnull:
            t = TYnptr;
            break;

        case Tvector:
        {
            TypeVector *tv = (TypeVector *)tx;
            TypeBasic *tb = tv->elementType();
            switch (tb->ty)
            {
                case Tvoid:
                case Tint8:     t = TYschar16;  break;
                case Tuns8:     t = TYuchar16;  break;
                case Tint16:    t = TYshort8;   break;
                case Tuns16:    t = TYushort8;  break;
                case Tint32:    t = TYlong4;    break;
                case Tuns32:    t = TYulong4;   break;
                case Tint64:    t = TYllong2;   break;
                case Tuns64:    t = TYullong2;  break;
                case Tfloat32:  t = TYfloat4;   break;
                case Tfloat64:  t = TYdouble2;  break;
                default:
                    assert(0);
                    break;
            }
            assert(global.params.is64bit || global.params.isOSX);
            break;
        }

        case Tfunction:
        {
            TypeFunction *tf = (TypeFunction *)tx;
            switch (tf->linkage)
            {
                case LINKwindows:
                    if (global.params.is64bit)
                        goto Lc;
                    t = (tf->varargs == 1) ? TYnfunc : TYnsfunc;
                    break;
//.........这里部分代码省略.........
开发者ID:AlexBezzubenko,项目名称:dmd,代码行数:101,代码来源:glue.c


示例15: DistanceSquare

 Type DistanceSquare(const VVector& b) const {
     assert(x.size() == b.x.size());
     Type sum = 0.0;
     for (size_t i = 0; i < x.size(); ++i)
         sum += (x[i] - b.x[i]) * (x[i] - b.x[i]);
     return sum;
 }
开发者ID:kurpicz,项目名称:thrill,代码行数:7,代码来源:vector.hpp


示例16: GetType

Type* Protobuf::GetType(const Descriptor* descriptor) {
	TypeMap::iterator it = mTypeMap.find(descriptor);
	if (it != mTypeMap.end())
		return it->second;
	Type* result = mTypeMap[descriptor] = 
		new Type(this,
		factory.GetPrototype(descriptor)->New(),
		TypeTemplate->GetFunction()->NewInstance(),
		handles.size());
	handles.push_back(result);

    Handle<Array> types = handle_->GetInternalField(1).As<Array>();
    types->Set(types->Length(), result->handle_);
	return result;
}
开发者ID:ftcaicai,项目名称:GOD,代码行数:15,代码来源:protobuf.cpp


示例17: assert

static void
outputLifetimeByType(FILE* file, unsigned initialHeap)
{
    assert(initialHeap < AugHeapKinds);

    fprintf(file, "# Lifetime of %s things (in log2 bins) by type\n", heapName(initialHeap));
    fprintf(file, "# NB invalid unless execution was traced with appropriate zeal\n");
    fprintf(file, "# Total allocations: %" PRIu64 "\n", allocCount);

    // There are many types but few are frequently used.
    const size_t minObjectCount = 1;
    const size_t outputEntries = 10;
    std::vector<TypeId> topTypes;
    for (size_t i = 0; i < types.size(); ++i) {
        if (objectCountByType.at(i) > minObjectCount)
            topTypes.push_back(i);
    }
    std::sort(topTypes.begin(), topTypes.end(),
              [] (TypeId a, TypeId b) { return objectCountByType.at(a) > objectCountByType.at(b); });
    size_t count = std::min(outputEntries, topTypes.size());

    fprintf(file, "Lifetime");
    for (unsigned i = 0; i < count; ++i)
        fprintf(file, ", %15s", types[topTypes[i]].getName());
    fprintf(file, "\n");

    for (unsigned i = 0; i < lifetimeBins; ++i) {
        fprintf(file, "%8d", binLimit(i));
        for (unsigned j = 0; j < count; ++j)
            fprintf(file, ", %8" PRIu64,
                    objectCountByTypeHeapAndLifetime.at(topTypes[j])[initialHeap][i]);
        fprintf(file, "\n");
    }
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:34,代码来源:gcstats.cpp


示例18: p

 VVector operator - (const VVector& b) const {
     assert(x.size() == b.x.size());
     VVector p(x.size());
     for (size_t i = 0; i < x.size(); ++i) p.x[i] = x[i] - b.x[i];
     return p;
 }
开发者ID:kurpicz,项目名称:thrill,代码行数:6,代码来源:vector.hpp


示例19: dim

 size_t dim() const { return x.size(); }
开发者ID:kurpicz,项目名称:thrill,代码行数:1,代码来源:vector.hpp


示例20: size

 size_t size() const { return x.size(); }
开发者ID:kurpicz,项目名称:thrill,代码行数:1,代码来源:vector.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TypeVisitor类代码示例发布时间:2022-05-31
下一篇:
C++ TypeTest类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap