本文整理汇总了C++中DIType::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ DIType::isValid方法的具体用法?C++ DIType::isValid怎么用?C++ DIType::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIType
的用法示例。
在下文中一共展示了DIType::isValid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: getDoubleTy
DIType DebugInfo::getDoubleTy() {
if (DblTy.isValid())
return DblTy;
DblTy = DBuilder->createBasicType("double", 64, 64, dwarf::DW_ATE_float);
return DblTy;
}
示例3: addType
/// addType - Add type into Tys.
bool DebugInfoFinder::addType(DIType DT) {
if (!DT.isValid())
return false;
if (!NodesSeen.insert(DT))
return false;
TYs.push_back(DT);
return true;
}
示例4: 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 (BaseType.isDerivedType())
return DIDerivedType(BaseType).getOriginalTypeSize();
else
return BaseType.getSizeInBits();
}
return getSizeInBits();
}
示例5: getOrCreateType
/// getOrCreateType - Get the type from the cache or create a new type if
/// necessary.
DIType DebugInfo::getOrCreateType(tree type) {
DEBUGASSERT(type != NULL_TREE && type != error_mark_node &&
"Not a type.");
if (type == NULL_TREE || type == error_mark_node) return DIType();
// Should only be void if a pointer/reference/return type. Returning NULL
// allows the caller to produce a non-derived type.
if (TREE_CODE(type) == VOID_TYPE) return DIType();
// Check to see if the compile unit already has created this type.
std::map<tree_node *, WeakVH >::iterator I = TypeCache.find(type);
if (I != TypeCache.end())
if (Value *M = I->second)
return DIType(cast<MDNode>(M));
DIType MainTy;
if (type != TYPE_MAIN_VARIANT(type) && TYPE_MAIN_VARIANT(type))
MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type));
DIType Ty = createVariantType(type, MainTy);
if (Ty.isValid())
return Ty;
// Work out details of type.
switch (TREE_CODE(type)) {
case ERROR_MARK:
case LANG_TYPE:
case TRANSLATION_UNIT_DECL:
default: {
DEBUGASSERT(0 && "Unsupported type");
return DIType();
}
case POINTER_TYPE:
case REFERENCE_TYPE:
// Do not cache pointer type. The pointer may point to forward declared
// struct.
return createPointerType(type);
break;
case BLOCK_POINTER_TYPE: {
DEBUGASSERT (generic_block_literal_struct_type &&
"Generic struct type for Blocks is missing!");
tree tmp_type = build_pointer_type(generic_block_literal_struct_type);
Ty = createPointerType(tmp_type);
break;
}
case OFFSET_TYPE: {
// gen_type_die(TYPE_OFFSET_BASETYPE(type), context_die);
// gen_type_die(TREE_TYPE(type), context_die);
// gen_ptr_to_mbr_type_die(type, context_die);
// PR 7104
break;
}
case FUNCTION_TYPE:
case METHOD_TYPE:
Ty = createMethodType(type);
break;
case VECTOR_TYPE:
case ARRAY_TYPE:
Ty = createArrayType(type);
break;
case ENUMERAL_TYPE:
Ty = createEnumType(type);
break;
case RECORD_TYPE:
case QUAL_UNION_TYPE:
case UNION_TYPE:
return createStructType(type);
break;
case INTEGER_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case BOOLEAN_TYPE:
Ty = createBasicType(type);
break;
}
TypeCache[type] = WeakVH(Ty.getNode());
return Ty;
}