本文整理汇总了C++中cxtype类的典型用法代码示例。如果您正苦于以下问题:C++ cxtype类的具体用法?C++ cxtype怎么用?C++ cxtype使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cxtype类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MakeCXType
CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
CXTypeKind TK = CXType_Invalid;
if (TU && !T.isNull()) {
ASTContext &Ctx = cxtu::getASTUnit(TU)->getASTContext();
if (Ctx.getLangOpts().ObjC1) {
QualType UnqualT = T.getUnqualifiedType();
if (Ctx.isObjCIdType(UnqualT))
TK = CXType_ObjCId;
else if (Ctx.isObjCClassType(UnqualT))
TK = CXType_ObjCClass;
else if (Ctx.isObjCSelType(UnqualT))
TK = CXType_ObjCSel;
}
/* Handle decayed types as the original type */
if (const DecayedType *DT = T->getAs<DecayedType>()) {
return MakeCXType(DT->getOriginalType(), TU);
}
}
if (TK == CXType_Invalid)
TK = GetTypeKind(T);
CXType CT = { TK, { TK == CXType_Invalid ? 0 : T.getAsOpaquePtr(), TU }};
return CT;
}
开发者ID:bholt,项目名称:clang,代码行数:26,代码来源:CXType.cpp
示例2: MakeCXType
CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
CXTypeKind TK = CXType_Invalid;
if (TU && !T.isNull()) {
// Handle attributed types as the original type
if (auto *ATT = T->getAs<AttributedType>()) {
if (!(TU->ParsingOptions & CXTranslationUnit_IncludeAttributedTypes)) {
return MakeCXType(ATT->getModifiedType(), TU);
}
}
// Handle paren types as the original type
if (auto *PTT = T->getAs<ParenType>()) {
return MakeCXType(PTT->getInnerType(), TU);
}
ASTContext &Ctx = cxtu::getASTUnit(TU)->getASTContext();
if (Ctx.getLangOpts().ObjC) {
QualType UnqualT = T.getUnqualifiedType();
if (Ctx.isObjCIdType(UnqualT))
TK = CXType_ObjCId;
else if (Ctx.isObjCClassType(UnqualT))
TK = CXType_ObjCClass;
else if (Ctx.isObjCSelType(UnqualT))
TK = CXType_ObjCSel;
}
/* Handle decayed types as the original type */
if (const DecayedType *DT = T->getAs<DecayedType>()) {
return MakeCXType(DT->getOriginalType(), TU);
}
}
if (TK == CXType_Invalid)
TK = GetTypeKind(T);
CXType CT = { TK, { TK == CXType_Invalid ? nullptr
: T.getAsOpaquePtr(), TU } };
return CT;
}
开发者ID:gbtitus,项目名称:chapel,代码行数:38,代码来源:CXType.cpp
示例3: clang_getCanonicalType
CXType clang_getCanonicalType(CXType CT) {
if (CT.kind == CXType_Invalid)
return CT;
QualType T = GetQualType(CT);
CXTranslationUnit TU = GetTU(CT);
if (T.isNull())
return MakeCXType(QualType(), GetTU(CT));
ASTUnit *AU = static_cast<ASTUnit*>(TU->TUData);
return MakeCXType(AU->getASTContext().getCanonicalType(T), TU);
}
开发者ID:ACSOP,项目名称:android_external_clang,代码行数:13,代码来源:CXType.cpp
示例4: clang_Type_getObjCTypeArg
CXType clang_Type_getObjCTypeArg(CXType CT, unsigned i) {
QualType T = GetQualType(CT);
if (T.isNull())
return MakeCXType(QualType(), GetTU(CT));
const ObjCObjectType *OT = dyn_cast<ObjCObjectType>(T);
if (!OT)
return MakeCXType(QualType(), GetTU(CT));
const ArrayRef<QualType> TA = OT->getTypeArgs();
if ((size_t)i >= TA.size())
return MakeCXType(QualType(), GetTU(CT));
return MakeCXType(TA[i], GetTU(CT));
}
开发者ID:gbtitus,项目名称:chapel,代码行数:15,代码来源:CXType.cpp
示例5: clang_getArrayElementType
CXType clang_getArrayElementType(CXType CT) {
QualType ET = QualType();
QualType T = GetQualType(CT);
const Type *TP = T.getTypePtrOrNull();
if (TP) {
switch (TP->getTypeClass()) {
case Type::ConstantArray:
ET = cast<ConstantArrayType> (TP)->getElementType();
break;
case Type::IncompleteArray:
ET = cast<IncompleteArrayType> (TP)->getElementType();
break;
case Type::VariableArray:
ET = cast<VariableArrayType> (TP)->getElementType();
break;
case Type::DependentSizedArray:
ET = cast<DependentSizedArrayType> (TP)->getElementType();
break;
default:
break;
}
}
return MakeCXType(ET, GetTU(CT));
}
开发者ID:CSI-LLVM,项目名称:clang,代码行数:25,代码来源:CXType.cpp
示例6: clang_Type_getClassType
CXType clang_Type_getClassType(CXType CT) {
QualType ET = QualType();
QualType T = GetQualType(CT);
const Type *TP = T.getTypePtrOrNull();
if (TP && TP->getTypeClass() == Type::MemberPointer) {
ET = QualType(cast<MemberPointerType> (TP)->getClass(), 0);
}
return MakeCXType(ET, GetTU(CT));
}
开发者ID:CSI-LLVM,项目名称:clang,代码行数:10,代码来源:CXType.cpp
示例7: clang_getPointeeType
CXType clang_getPointeeType(CXType CT) {
QualType T = GetQualType(CT);
const Type *TP = T.getTypePtrOrNull();
if (!TP)
return MakeCXType(QualType(), GetTU(CT));
try_again:
switch (TP->getTypeClass()) {
case Type::Pointer:
T = cast<PointerType>(TP)->getPointeeType();
break;
case Type::BlockPointer:
T = cast<BlockPointerType>(TP)->getPointeeType();
break;
case Type::LValueReference:
case Type::RValueReference:
T = cast<ReferenceType>(TP)->getPointeeType();
break;
case Type::ObjCObjectPointer:
T = cast<ObjCObjectPointerType>(TP)->getPointeeType();
break;
case Type::MemberPointer:
T = cast<MemberPointerType>(TP)->getPointeeType();
break;
case Type::Auto:
case Type::DeducedTemplateSpecialization:
TP = cast<DeducedType>(TP)->getDeducedType().getTypePtrOrNull();
if (TP)
goto try_again;
break;
default:
T = QualType();
break;
}
return MakeCXType(T, GetTU(CT));
}
开发者ID:gbtitus,项目名称:chapel,代码行数:37,代码来源:CXType.cpp
示例8: clang_Type_getTemplateArgumentAsType
CXType clang_Type_getTemplateArgumentAsType(CXType CT, unsigned i) {
QualType T = GetQualType(CT);
if (T.isNull())
return MakeCXType(QualType(), GetTU(CT));
const CXXRecordDecl *RecordDecl = T->getAsCXXRecordDecl();
if (!RecordDecl)
return MakeCXType(QualType(), GetTU(CT));
const ClassTemplateSpecializationDecl *TemplateDecl =
dyn_cast<ClassTemplateSpecializationDecl>(RecordDecl);
if (!TemplateDecl)
return MakeCXType(QualType(), GetTU(CT));
const TemplateArgumentList &TA = TemplateDecl->getTemplateArgs();
if (TA.size() <= i)
return MakeCXType(QualType(), GetTU(CT));
const TemplateArgument &A = TA.get(i);
if (A.getKind() != TemplateArgument::Type)
return MakeCXType(QualType(), GetTU(CT));
return MakeCXType(A.getAsType(), GetTU(CT));
}
开发者ID:CSI-LLVM,项目名称:clang,代码行数:19,代码来源:CXType.cpp
注:本文中的cxtype类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论