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


C++ DIType::isDerivedType方法代码示例

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


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

示例1: processType

void DebugInfoFinder::processType(DIType DT) {
  if (!addType(DT))
    return;
  processScope(DT.getContext().resolve(TypeIdentifierMap));
  if (DT.isCompositeType()) {
    DICompositeType DCT(DT);
    processType(DCT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
    if (DT.isSubroutineType()) {
      DITypeArray DTA = DISubroutineType(DT).getTypeArray();
      for (unsigned i = 0, e = DTA.getNumElements(); i != e; ++i)
        processType(DTA.getElement(i).resolve(TypeIdentifierMap));
      return;
    }
    DIArray DA = DCT.getElements();
    for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
      DIDescriptor D = DA.getElement(i);
      if (D.isType())
        processType(DIType(D));
      else if (D.isSubprogram())
        processSubprogram(DISubprogram(D));
    }
  } else if (DT.isDerivedType()) {
    DIDerivedType DDT(DT);
    processType(DDT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
  }
}
开发者ID:cschreiner,项目名称:llvm,代码行数:26,代码来源:DebugInfo.cpp

示例2: getOriginalTypeSize

/// getOriginalTypeSize - If this type is derived from a base type then
/// return base type size.
uint64_t DIDerivedType::getOriginalTypeSize() const {
  unsigned Tag = getTag();

  if (Tag == dwarf::DW_TAG_member || Tag == dwarf::DW_TAG_typedef ||
      Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||
      Tag == dwarf::DW_TAG_restrict_type) {
    DIType BaseType = getTypeDerivedFrom();
    // If this type is not derived from any type then take conservative
    // approach.
    if (!BaseType.isValid())
      return getSizeInBits();
    // If this is a derived type, go ahead and get the base type, unless
    // it's a reference then it's just the size of the field. Pointer types
    // have no need of this since they're a different type of qualification
    // on the type.
    if (BaseType.getTag() == dwarf::DW_TAG_reference_type)
      return getSizeInBits();
    else if (BaseType.isDerivedType())
      return DIDerivedType(BaseType).getOriginalTypeSize();
    else
      return BaseType.getSizeInBits();
  }

  return getSizeInBits();
}
开发者ID:PhongNgo,项目名称:llvm,代码行数:27,代码来源:DebugInfo.cpp

示例3: getMemberName

std::string StructInfo::getMemberName(ArrayRef<unsigned> indices)
{
    if (!m_debugInfoStructType) {
        return "<no name>";
    }

    llvm::Type *curType = m_structType;
    DIType diType = *m_debugInfoStructType;
    std::stringstream ss;

    ss << getName();

    for (unsigned index : indices)
    {
        if (StructType *structType = dyn_cast<StructType>(curType)) {
            if (diType.isDerivedType() && !diType.isCompositeType()) {
                diType = DIDerivedType(diType).getTypeDerivedFrom().resolve(*m_typeIdentifierMap); 
            }
            if (!diType.isCompositeType()) {
                llvm::errs() << "ERROR: C type is a StructType, but DWARF debug information is not a composite type." << '\n';
                assert(false);
                exit(1);
            }
            DICompositeType diCompositeType(diType);
            DIDerivedType diMemberType(diCompositeType.getTypeArray().getElement(index));

            ss << "." << diMemberType.getName().str();

            curType = structType->getContainedType(index);
            diType = diMemberType.getTypeDerivedFrom().resolve(*m_typeIdentifierMap);
        }
        else if (ArrayType *arrayType = dyn_cast<ArrayType>(curType)) {
            assert(diType.isDerivedType());
            //TODO
            DIDerivedType diDerivedType(diType);
            ss << "[" << std::dec << index << "]";
            curType = arrayType->getElementType();
            diType = diDerivedType.getTypeDerivedFrom().resolve(*m_typeIdentifierMap);
        }
        else {
            assert(false && "Offset pointing in the middle of a basic data type");
            return "<error>";
        }
    }

    return ss.str();
}
开发者ID:suezi,项目名称:libqemu,代码行数:47,代码来源:CpuArchStructInfo.cpp

示例4: getDICompositeType

/// getDICompositeType - Find underlying composite type.
DICompositeType llvm::getDICompositeType(DIType T) {
  if (T.isCompositeType())
    return DICompositeType(T);

  if (T.isDerivedType())
    return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());

  return DICompositeType();
}
开发者ID:PhongNgo,项目名称:llvm,代码行数:10,代码来源:DebugInfo.cpp

示例5: FormatDIType

void DIEItem::FormatDIType(wxTextOutputStream& out, DIType type) const {
  if (type.isCompositeType()) {
    DICompositeType diCompType(type);
    if (!type.getName().empty()) {
      out << toWxStr(type.getName());
    } else {
      out << _("?Implement unnamed composite");
      // TODO: Implement:
      // DW_TAG_array_type
      // DW_TAG_enumeration_type
      // DW_TAG_structure_type
      // DW_TAG_union_type
      // DW_TAG_vector_type
      // DW_TAG_subroutine_type
      // DW_TAG_inheritance
    }
  } else if (type.isDerivedType()) {
    DIDerivedType diDerivedType(type);
    DIType diBase = diDerivedType.getTypeDerivedFrom();
    switch (diDerivedType.getTag()) {
      case dwarf::DW_TAG_inheritance:
        FormatDIType(out, diBase);
        break;

      case dwarf::DW_TAG_pointer_type:
        FormatDIType(out, diBase);
        out << _("*");
        break;

      case dwarf::DW_TAG_array_type:
        FormatDIType(out, diBase);
        // TODO: Get the array size, use LLVM array notation.
        out << _("[]");
        break;

      case dwarf::DW_TAG_member:
        out << toWxStr(diDerivedType.getName());
        break;

      case dwarf::DW_TAG_reference_type:
      case dwarf::DW_TAG_const_type:
      case dwarf::DW_TAG_volatile_type:
      case dwarf::DW_TAG_restrict_type:
      case dwarf::DW_TAG_typedef:
        // TODO: Implement
        break;
    }
  } else if (type.isBasicType()) {
    DIBasicType diBasicType(type);
    const char * encodingName =
        dwarf::AttributeEncodingString(diBasicType.getEncoding());
    if (encodingName != NULL) {
      out << toWxStr(encodingName);
    }
  }
}
开发者ID:lht,项目名称:llbrowse,代码行数:56,代码来源:TreeView.cpp

示例6: getSizeInBits

/// \brief Return the size reported by the variable's type.
unsigned DIVariable::getSizeInBits(const DITypeIdentifierMap &Map) {
  DIType Ty = getType().resolve(Map);
  // Follow derived types until we reach a type that
  // reports back a size.
  while (Ty.isDerivedType() && !Ty.getSizeInBits()) {
    DIDerivedType DT(&*Ty);
    Ty = DT.getTypeDerivedFrom().resolve(Map);
  }
  assert(Ty.getSizeInBits() && "type with size 0");
  return Ty.getSizeInBits();
}
开发者ID:cschreiner,项目名称:llvm,代码行数:12,代码来源:DebugInfo.cpp

示例7: if

/// PopulateDebugInfo - Populate the TypeNo, Aux[] and TagName from Ty.
///
void PIC16DbgInfo::PopulateDebugInfo (DIType Ty, unsigned short &TypeNo,
                                      bool &HasAux, int Aux[], 
                                      std::string &TagName) {
  if (Ty.isBasicType(Ty.getTag())) 
    PopulateBasicTypeInfo (Ty, TypeNo);
  else if (Ty.isDerivedType(Ty.getTag())) 
    PopulateDerivedTypeInfo (Ty, TypeNo, HasAux, Aux, TagName);
  else if (Ty.isCompositeType(Ty.getTag())) 
    PopulateCompositeTypeInfo (Ty, TypeNo, HasAux, Aux, TagName);
  else {
    TypeNo = PIC16Dbg::T_NULL;
    HasAux = false;
  }
  return;
}
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:17,代码来源:PIC16DebugInfo.cpp

示例8: getDICompositeType

DICompositeType llvm::getDICompositeType(DIType T) {
  if (T.isCompositeType())
    return DICompositeType(T);

  if (T.isDerivedType()) {
    // This function is currently used by dragonegg and dragonegg does
    // not generate identifier for types, so using an empty map to resolve
    // DerivedFrom should be fine.
    DITypeIdentifierMap EmptyMap;
    return getDICompositeType(
        DIDerivedType(T).getTypeDerivedFrom().resolve(EmptyMap));
  }

  return DICompositeType();
}
开发者ID:cschreiner,项目名称:llvm,代码行数:15,代码来源:DebugInfo.cpp

示例9: getOriginalTypeSize

/// getOriginalTypeSize - If this type is derived from a base type then
/// return base type size.
uint64_t DIDerivedType::getOriginalTypeSize() const {
  unsigned Tag = getTag();
  if (Tag == dwarf::DW_TAG_member || Tag == dwarf::DW_TAG_typedef ||
      Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||
      Tag == dwarf::DW_TAG_restrict_type) {
    DIType BaseType = getTypeDerivedFrom();
    // If this type is not derived from any type then take conservative 
    // approach.
    if (BaseType.isNull())
      return getSizeInBits();
    if (BaseType.isDerivedType())
      return DIDerivedType(BaseType.getNode()).getOriginalTypeSize();
    else
      return BaseType.getSizeInBits();
  }
    
  return getSizeInBits();
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例10: processType

/// processType - Process DIType.
void DebugInfoFinder::processType(DIType DT) {
  if (!addType(DT))
    return;
  if (DT.isCompositeType()) {
    DICompositeType DCT(DT);
    processType(DCT.getTypeDerivedFrom());
    DIArray DA = DCT.getTypeArray();
    for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
      DIDescriptor D = DA.getElement(i);
      if (D.isType())
        processType(DIType(D));
      else if (D.isSubprogram())
        processSubprogram(DISubprogram(D));
    }
  } else if (DT.isDerivedType()) {
    DIDerivedType DDT(DT);
    processType(DDT.getTypeDerivedFrom());
  }
}
开发者ID:sethfowler,项目名称:llvm,代码行数:20,代码来源:DebugInfo.cpp

示例11: processType

/// processType - Process DIType.
void DebugInfoFinder::processType(DIType DT) {
  if (!addType(DT))
    return;

  addCompileUnit(DT.getCompileUnit());
  if (DT.isCompositeType()) {
    DICompositeType DCT(DT.getNode());
    processType(DCT.getTypeDerivedFrom());
    DIArray DA = DCT.getTypeArray();
    if (!DA.isNull())
      for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
        DIDescriptor D = DA.getElement(i);
        DIType TypeE = DIType(D.getNode());
        if (!TypeE.isNull())
          processType(TypeE);
        else
          processSubprogram(DISubprogram(D.getNode()));
      }
  } else if (DT.isDerivedType()) {
    DIDerivedType DDT(DT.getNode());
    if (!DDT.isNull())
      processType(DDT.getTypeDerivedFrom());
  }
}
开发者ID:,项目名称:,代码行数:25,代码来源:


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