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


C++ TypeIndex::isSimple方法代码示例

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


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

示例1: getTypeName

StringRef CVTypeDumper::getTypeName(TypeIndex TI) {
  if (TI.isNoType())
    return "<no type>";

  if (TI.isSimple()) {
    // This is a simple type.
    for (const auto &SimpleTypeName : SimpleTypeNames) {
      if (SimpleTypeName.Value == TI.getSimpleKind()) {
        if (TI.getSimpleMode() == SimpleTypeMode::Direct)
          return SimpleTypeName.Name.drop_back(1);
        // Otherwise, this is a pointer type. We gloss over the distinction
        // between near, far, 64, 32, etc, and just give a pointer type.
        return SimpleTypeName.Name;
      }
    }
    return "<unknown simple type>";
  }

  // User-defined type.
  StringRef UDTName;
  unsigned UDTIndex = TI.getIndex() - 0x1000;
  if (UDTIndex < CVUDTNames.size())
    return CVUDTNames[UDTIndex];

  return "<unknown UDT>";
}
开发者ID:zhmz90,项目名称:llvm,代码行数:26,代码来源:TypeDumper.cpp

示例2: GetIntegralTypeInfo

static std::pair<size_t, bool> GetIntegralTypeInfo(TypeIndex ti,
                                                   TpiStream &tpi) {
  if (ti.isSimple()) {
    SimpleTypeKind stk = ti.getSimpleKind();
    return {GetTypeSizeForSimpleKind(stk), IsSimpleTypeSignedInteger(stk)};
  }

  CVType cvt = tpi.getType(ti);
  switch (cvt.kind()) {
  case LF_MODIFIER: {
    ModifierRecord mfr;
    llvm::cantFail(TypeDeserializer::deserializeAs<ModifierRecord>(cvt, mfr));
    return GetIntegralTypeInfo(mfr.ModifiedType, tpi);
  }
  case LF_POINTER: {
    PointerRecord pr;
    llvm::cantFail(TypeDeserializer::deserializeAs<PointerRecord>(cvt, pr));
    return GetIntegralTypeInfo(pr.ReferentType, tpi);
  }
  case LF_ENUM: {
    EnumRecord er;
    llvm::cantFail(TypeDeserializer::deserializeAs<EnumRecord>(cvt, er));
    return GetIntegralTypeInfo(er.UnderlyingType, tpi);
  }
  default:
    assert(false && "Type is not integral!");
    return {0, false};
  }
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:29,代码来源:DWARFLocationExpression.cpp

示例3: remapIndex

bool TypeStreamMerger::remapIndex(TypeIndex &Idx, ArrayRef<TypeIndex> Map) {
  // Simple types are unchanged.
  if (Idx.isSimple())
    return true;

  // Check if this type index refers to a record we've already translated
  // successfully. If it refers to a type later in the stream or a record we
  // had to defer, defer it until later pass.
  unsigned MapPos = slotForIndex(Idx);
  if (MapPos < Map.size() && Map[MapPos] != Untranslated) {
    Idx = Map[MapPos];
    return true;
  }

  // If this is the second pass and this index isn't in the map, then it points
  // outside the current type stream, and this is a corrupt record.
  if (IsSecondPass && MapPos >= Map.size()) {
    // FIXME: Print a more useful error. We can give the current record and the
    // index that we think its pointing to.
    LastError = joinErrors(std::move(*LastError), errorCorruptRecord());
  }

  ++NumBadIndices;

  // This type index is invalid. Remap this to "not translated by cvpack",
  // and return failure.
  Idx = Untranslated;
  return false;
}
开发者ID:BNieuwenhuizen,项目名称:llvm,代码行数:29,代码来源:TypeStreamMerger.cpp

示例4: remapTypeIndex

static bool remapTypeIndex(TypeIndex &TI, ArrayRef<TypeIndex> TypeIndexMap) {
  if (TI.isSimple())
    return true;
  if (TI.toArrayIndex() >= TypeIndexMap.size())
    return false;
  TI = TypeIndexMap[TI.toArrayIndex()];
  return true;
}
开发者ID:Leedehai,项目名称:lld,代码行数:8,代码来源:PDB.cpp

示例5:

void llvm::codeview::printTypeIndex(ScopedPrinter &Printer, StringRef FieldName,
                                    TypeIndex TI, TypeCollection &Types) {
  StringRef TypeName;
  if (!TI.isNoneType()) {
    if (TI.isSimple())
      TypeName = TypeIndex::simpleTypeName(TI);
    else
      TypeName = Types.getTypeName(TI);
  }

  if (!TypeName.empty())
    Printer.printHex(FieldName, TypeName, TI.getIndex());
  else
    Printer.printHex(FieldName, TI.getIndex());
}
开发者ID:CTSRD-CHERI,项目名称:cheribsd,代码行数:15,代码来源:TypeIndex.cpp

示例6: simpleTypeName

StringRef TypeIndex::simpleTypeName(TypeIndex TI) {
  assert(TI.isNoneType() || TI.isSimple());

  if (TI.isNoneType())
    return "<no type>";

  if (TI == TypeIndex::NullptrT())
    return "std::nullptr_t";

  // This is a simple type.
  for (const auto &SimpleTypeName : SimpleTypeNames) {
    if (SimpleTypeName.Kind == TI.getSimpleKind()) {
      if (TI.getSimpleMode() == SimpleTypeMode::Direct)
        return SimpleTypeName.Name.drop_back(1);
      // Otherwise, this is a pointer type. We gloss over the distinction
      // between near, far, 64, 32, etc, and just give a pointer type.
      return SimpleTypeName.Name;
    }
  }
  return "<unknown simple type>";
}
开发者ID:CTSRD-CHERI,项目名称:cheribsd,代码行数:21,代码来源:TypeIndex.cpp

示例7: getTypeName

StringRef TypeDatabase::getTypeName(TypeIndex Index) const {
  if (Index.isNoneType())
    return "<no type>";

  if (Index.isSimple()) {
    // This is a simple type.
    for (const auto &SimpleTypeName : SimpleTypeNames) {
      if (SimpleTypeName.Kind == Index.getSimpleKind()) {
        if (Index.getSimpleMode() == SimpleTypeMode::Direct)
          return SimpleTypeName.Name.drop_back(1);
        // Otherwise, this is a pointer type. We gloss over the distinction
        // between near, far, 64, 32, etc, and just give a pointer type.
        return SimpleTypeName.Name;
      }
    }
    return "<unknown simple type>";
  }

  uint32_t I = Index.getIndex() - TypeIndex::FirstNonSimpleIndex;
  if (I < CVUDTNames.size())
    return CVUDTNames[I];

  return "<unknown UDT>";
}
开发者ID:dberlin,项目名称:llvm-gvn-rewrite,代码行数:24,代码来源:TypeDatabase.cpp


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