Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
void ODRHash::AddQualType(QualType T) {
  AddBoolean(T.isNull());
  if (T.isNull())
    return;
  SplitQualType split = T.split();
  ID.AddInteger(split.Quals.getAsOpaqueValue());
  AddType(split.Ty);
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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) << "'";
  }
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
QualType ASTContext::getTypeWithQualifers(QualType Type, Qualifiers Quals) {
  auto Split = Type.split();
  return getExtQualType(Split.first, Quals);
}
Exemplo n.º 9
0
void TypePrinter::printAfter(QualType t, raw_ostream &OS) {
  SplitQualType split = t.split();
  printAfter(split.Ty, split.Quals, OS);
}
Exemplo n.º 10
0
void TypePrinter::print(QualType t, raw_ostream &OS, StringRef PlaceHolder) {
  SplitQualType split = t.split();
  print(split.Ty, split.Quals, OS, PlaceHolder);
}
Exemplo n.º 11
0
void TypePrinter::print(QualType t, std::string &buffer) {
  SplitQualType split = t.split();
  print(split.first, split.second, buffer);
}
Exemplo n.º 12
0
void TypePrinter::print(QualType t, std::string &buffer) {
  SplitQualType split = t.split();
  print(split.Ty, split.Quals, buffer);
}