QualType stripType(const QualType & qualType) { QualType qType = qualType; SplitQualType splitQualType = qType.split(); const Type * t = splitQualType.Ty; for(;;) { if(t->isArrayType()) { qType = dyn_cast<ArrayType>(t->getCanonicalTypeInternal())->getElementType(); } else if(t->isPointerType()) { qType = dyn_cast<PointerType>(t)->getPointeeType(); } else if(t->isReferenceType()) { qType = dyn_cast<ReferenceType>(t)->getPointeeType(); } else { break; } splitQualType = qType.split(); t = splitQualType.Ty; } return qType; }
void ODRHash::AddQualType(QualType T) { AddBoolean(T.isNull()); if (T.isNull()) return; SplitQualType split = T.split(); ID.AddInteger(split.Quals.getAsOpaqueValue()); AddType(split.Ty); }
static QualType getTypeWithAttribute(ASTContext &C, QualType T, Qualifiers::AS AS) { auto Split = T.split(); if(Split.second.hasAttributeSpec(AS)) return T; QualifierCollector QC(Split.second); QC.addAttributeSpecs(AS); return C.getTypeWithQualifers(T, QC); }
QualType ASTContext::getQualTypeOtherKind(QualType Type, QualType KindType) { auto BTy = Type->asBuiltinType(); auto DesiredBTy = KindType->asBuiltinType(); if(BTy->getBuiltinTypeKind() == DesiredBTy->getBuiltinTypeKind()) return Type; auto Split = Type.split(); return getExtQualType(getBuiltinType(BTy->getTypeSpec(), DesiredBTy->getBuiltinTypeKind(), DesiredBTy->isKindExplicitlySpecified(), DesiredBTy->isDoublePrecisionKindSpecified(), DesiredBTy->isByteKindSpecified()), Split.second); }
void ASTDumper::dumpBareType(QualType T) { SplitQualType T_split = T.split(); OS << "'" << QualType::getAsString(T_split) << "'"; if (!T.isNull()) { // If the type is sugared, also dump a (shallow) desugared type. SplitQualType D_split = T.getSplitDesugaredType(); if (T_split != D_split) OS << ":'" << QualType::getAsString(D_split) << "'"; } }
void TypePrinter::printBefore(QualType T, raw_ostream &OS) { SplitQualType Split = T.split(); // If we have cv1 T, where T is substituted for cv2 U, only print cv1 - cv2 // at this level. Qualifiers Quals = Split.Quals; if (const SubstTemplateTypeParmType *Subst = dyn_cast<SubstTemplateTypeParmType>(Split.Ty)) Quals -= QualType(Subst, 0).getQualifiers(); printBefore(Split.Ty, Quals, OS); }
bool VisitObjCMessageExpr(ObjCMessageExpr *node) { if (!node->isImplicit()) { if (node->getReceiverKind() == ObjCMessageExpr::Instance) { if (node->getReceiverInterface()) { countInterface(node->getReceiverInterface()); } } else if (node->getReceiverKind() == ObjCMessageExpr::Class) { QualType qualType = node->getClassReceiver(); countClassName(QualType::getAsString(qualType.split())); } } return true; }
QualType ASTContext::getTypeWithQualifers(QualType Type, Qualifiers Quals) { auto Split = Type.split(); return getExtQualType(Split.first, Quals); }
void TypePrinter::printAfter(QualType t, raw_ostream &OS) { SplitQualType split = t.split(); printAfter(split.Ty, split.Quals, OS); }
void TypePrinter::print(QualType t, raw_ostream &OS, StringRef PlaceHolder) { SplitQualType split = t.split(); print(split.Ty, split.Quals, OS, PlaceHolder); }
void TypePrinter::print(QualType t, std::string &buffer) { SplitQualType split = t.split(); print(split.first, split.second, buffer); }
void TypePrinter::print(QualType t, std::string &buffer) { SplitQualType split = t.split(); print(split.Ty, split.Quals, buffer); }