예제 #1
0
파일: cpputil.cpp 프로젝트: Remscar/cpgf
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;
}
예제 #2
0
파일: ODRHash.cpp 프로젝트: Teemperor/clang
void ODRHash::AddQualType(QualType T) {
  AddBoolean(T.isNull());
  if (T.isNull())
    return;
  SplitQualType split = T.split();
  ID.AddInteger(split.Quals.getAsOpaqueValue());
  AddType(split.Ty);
}
예제 #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);
}
예제 #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) << "'";
  }
}
예제 #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);
}
예제 #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;
 }
예제 #8
0
QualType ASTContext::getTypeWithQualifers(QualType Type, Qualifiers Quals) {
  auto Split = Type.split();
  return getExtQualType(Split.first, Quals);
}
예제 #9
0
void TypePrinter::printAfter(QualType t, raw_ostream &OS) {
  SplitQualType split = t.split();
  printAfter(split.Ty, split.Quals, OS);
}
예제 #10
0
void TypePrinter::print(QualType t, raw_ostream &OS, StringRef PlaceHolder) {
  SplitQualType split = t.split();
  print(split.Ty, split.Quals, OS, PlaceHolder);
}
예제 #11
0
void TypePrinter::print(QualType t, std::string &buffer) {
  SplitQualType split = t.split();
  print(split.first, split.second, buffer);
}
예제 #12
0
void TypePrinter::print(QualType t, std::string &buffer) {
  SplitQualType split = t.split();
  print(split.Ty, split.Quals, buffer);
}