本文整理汇总了C++中clang::QualType::getAsArrayTypeUnsafe方法的典型用法代码示例。如果您正苦于以下问题:C++ QualType::getAsArrayTypeUnsafe方法的具体用法?C++ QualType::getAsArrayTypeUnsafe怎么用?C++ QualType::getAsArrayTypeUnsafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::QualType
的用法示例。
在下文中一共展示了QualType::getAsArrayTypeUnsafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StreamArr
static void StreamArr(llvm::raw_ostream& o, const void* V, clang::QualType Ty,
cling::Interpreter& interp) {
clang::ASTContext& C = interp.getCI()->getASTContext();
const clang::ArrayType* ArrTy = Ty->getAsArrayTypeUnsafe();
clang::QualType ElementTy = ArrTy->getElementType();
if (ElementTy->isCharType())
StreamCharPtr(o, (const char*)V);
else if (Ty->isConstantArrayType()) {
// Stream a constant array by streaming up to 5 elements.
const clang::ConstantArrayType* CArrTy
= C.getAsConstantArrayType(Ty);
const llvm::APInt& APSize = CArrTy->getSize();
size_t ElBytes = C.getTypeSize(ElementTy) / C.getCharWidth();
size_t Size = (size_t)APSize.getZExtValue();
o << "{ ";
for (size_t i = 0; i < Size; ++i) {
// Handle the case of constant size array of pointers. Eg. const char*[]
if (ElementTy->isPointerType())
StreamValue(o, *(const char* const *)V + i * ElBytes, ElementTy, interp);
else
StreamValue(o, (const char*)V + i * ElBytes, ElementTy, interp);
if (i + 1 < Size) {
if (i == 4) {
o << "...";
break;
}
else o << ", ";
}
}
o << " }";
} else
StreamPtr(o, V);
}
示例2: RequireCompleteType
bool ClangASTImporter::RequireCompleteType(clang::QualType type) {
if (type.isNull())
return false;
if (const TagType *tag_type = type->getAs<TagType>()) {
TagDecl *tag_decl = tag_type->getDecl();
if (tag_decl->getDefinition() || tag_decl->isBeingDefined())
return true;
return CompleteTagDecl(tag_decl);
}
if (const ObjCObjectType *objc_object_type = type->getAs<ObjCObjectType>()) {
if (ObjCInterfaceDecl *objc_interface_decl =
objc_object_type->getInterface())
return CompleteObjCInterfaceDecl(objc_interface_decl);
else
return false;
}
if (const ArrayType *array_type = type->getAsArrayTypeUnsafe()) {
return RequireCompleteType(array_type->getElementType());
}
if (const AtomicType *atomic_type = type->getAs<AtomicType>()) {
return RequireCompleteType(atomic_type->getPointeeType());
}
return true;
}