本文整理汇总了C++中clang::QualType::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QualType::isNull方法的具体用法?C++ QualType::isNull怎么用?C++ QualType::isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::QualType
的用法示例。
在下文中一共展示了QualType::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Init
void ValuePrinterInfo::Init(clang::QualType Ty) {
assert(!Ty.isNull() && "Type must be valid!");
assert(m_Context && "ASTContext cannot be null!");
assert(sizeof(m_Type) >= sizeof(clang::QualType) && "m_Type too small!");
m_Type = *reinterpret_cast<void**>(&Ty);
// 1. Get the flags
if (Ty.isLocalConstQualified() || Ty.isConstant(*m_Context)){
m_Flags |= VPI_Const;
}
if (Ty->isPointerType()) {
// treat arrary-to-pointer decay as array:
QualType PQT = Ty->getPointeeType();
const Type* PTT = PQT.getTypePtr();
if (!PTT || !PTT->isArrayType()) {
m_Flags |= VPI_Ptr;
if (const RecordType* RT = dyn_cast<RecordType>(Ty.getTypePtr()))
if (RecordDecl* RD = RT->getDecl()) {
CXXRecordDecl* CRD = dyn_cast<CXXRecordDecl>(RD);
if (CRD && CRD->isPolymorphic())
m_Flags |= VPI_Polymorphic;
}
}
}
}
示例3: TraverseType
bool TraverseType(clang::QualType type)
{
if (type.isNull())
{
return PARENT::TraverseType(type);
}
auto node = std::make_unique<GenericAstNode>();
//node->myType = d;
node->name = type->getTypeClassName();
auto nodePtr = node.get();
myStack.back()->attach(std::move(node));
myStack.push_back(nodePtr);
auto res = PARENT::TraverseType(type);
myStack.pop_back();
return res;
}