本文整理汇总了C++中ASTContext::getPointerDiffType方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTContext::getPointerDiffType方法的具体用法?C++ ASTContext::getPointerDiffType怎么用?C++ ASTContext::getPointerDiffType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTContext
的用法示例。
在下文中一共展示了ASTContext::getPointerDiffType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getArgType
ScanfArgTypeResult ScanfSpecifier::getArgType(ASTContext &Ctx) const {
const ScanfConversionSpecifier &CS = getConversionSpecifier();
if (!CS.consumesDataArgument())
return ScanfArgTypeResult::Invalid();
switch(CS.getKind()) {
// Signed int.
case ConversionSpecifier::dArg:
case ConversionSpecifier::iArg:
switch (LM.getKind()) {
case LengthModifier::None: return ArgTypeResult(Ctx.IntTy);
case LengthModifier::AsChar:
return ArgTypeResult(ArgTypeResult::AnyCharTy);
case LengthModifier::AsShort: return ArgTypeResult(Ctx.ShortTy);
case LengthModifier::AsLong: return ArgTypeResult(Ctx.LongTy);
case LengthModifier::AsLongLong: return ArgTypeResult(Ctx.LongLongTy);
case LengthModifier::AsIntMax:
return ScanfArgTypeResult(Ctx.getIntMaxType(), "intmax_t *");
case LengthModifier::AsSizeT:
// FIXME: ssize_t.
return ScanfArgTypeResult();
case LengthModifier::AsPtrDiff:
return ScanfArgTypeResult(Ctx.getPointerDiffType(), "ptrdiff_t *");
case LengthModifier::AsLongDouble: return ScanfArgTypeResult::Invalid();
case LengthModifier::AsAllocate: return ScanfArgTypeResult::Invalid();
case LengthModifier::AsMAllocate: return ScanfArgTypeResult::Invalid();
}
// Unsigned int.
case ConversionSpecifier::oArg:
case ConversionSpecifier::uArg:
case ConversionSpecifier::xArg:
case ConversionSpecifier::XArg:
switch (LM.getKind()) {
case LengthModifier::None: return ArgTypeResult(Ctx.UnsignedIntTy);
case LengthModifier::AsChar: return ArgTypeResult(Ctx.UnsignedCharTy);
case LengthModifier::AsShort: return ArgTypeResult(Ctx.UnsignedShortTy);
case LengthModifier::AsLong: return ArgTypeResult(Ctx.UnsignedLongTy);
case LengthModifier::AsLongLong:
return ArgTypeResult(Ctx.UnsignedLongLongTy);
case LengthModifier::AsIntMax:
return ScanfArgTypeResult(Ctx.getUIntMaxType(), "uintmax_t *");
case LengthModifier::AsSizeT:
return ScanfArgTypeResult(Ctx.getSizeType(), "size_t *");
case LengthModifier::AsPtrDiff:
// FIXME: Unsigned version of ptrdiff_t?
return ScanfArgTypeResult();
case LengthModifier::AsLongDouble: return ScanfArgTypeResult::Invalid();
case LengthModifier::AsAllocate: return ScanfArgTypeResult::Invalid();
case LengthModifier::AsMAllocate: return ScanfArgTypeResult::Invalid();
}
// Float.
case ConversionSpecifier::aArg:
case ConversionSpecifier::AArg:
case ConversionSpecifier::eArg:
case ConversionSpecifier::EArg:
case ConversionSpecifier::fArg:
case ConversionSpecifier::FArg:
case ConversionSpecifier::gArg:
case ConversionSpecifier::GArg:
switch (LM.getKind()) {
case LengthModifier::None: return ArgTypeResult(Ctx.FloatTy);
case LengthModifier::AsLong: return ArgTypeResult(Ctx.DoubleTy);
case LengthModifier::AsLongDouble:
return ArgTypeResult(Ctx.LongDoubleTy);
default:
return ScanfArgTypeResult::Invalid();
}
// Char, string and scanlist.
case ConversionSpecifier::cArg:
case ConversionSpecifier::sArg:
case ConversionSpecifier::ScanListArg:
switch (LM.getKind()) {
case LengthModifier::None: return ScanfArgTypeResult::CStrTy;
case LengthModifier::AsLong:
return ScanfArgTypeResult(ScanfArgTypeResult::WCStrTy, "wchar_t *");
case LengthModifier::AsAllocate:
case LengthModifier::AsMAllocate:
return ScanfArgTypeResult(ArgTypeResult::CStrTy);
default:
return ScanfArgTypeResult::Invalid();
}
case ConversionSpecifier::CArg:
case ConversionSpecifier::SArg:
// FIXME: Mac OS X specific?
switch (LM.getKind()) {
case LengthModifier::None:
return ScanfArgTypeResult(ScanfArgTypeResult::WCStrTy, "wchar_t *");
case LengthModifier::AsAllocate:
case LengthModifier::AsMAllocate:
return ScanfArgTypeResult(ArgTypeResult::WCStrTy, "wchar_t **");
default:
return ScanfArgTypeResult::Invalid();
}
// Pointer.
case ConversionSpecifier::pArg:
//.........这里部分代码省略.........
示例2: getArgType
ArgType PrintfSpecifier::getArgType(ASTContext &Ctx,
bool IsObjCLiteral) const {
const PrintfConversionSpecifier &CS = getConversionSpecifier();
if (!CS.consumesDataArgument())
return ArgType::Invalid();
if (CS.getKind() == ConversionSpecifier::cArg)
switch (LM.getKind()) {
case LengthModifier::None:
return Ctx.IntTy;
case LengthModifier::AsLong:
case LengthModifier::AsWide:
return ArgType(ArgType::WIntTy, "wint_t");
case LengthModifier::AsShort:
if (Ctx.getTargetInfo().getTriple().isOSMSVCRT())
return Ctx.IntTy;
LLVM_FALLTHROUGH;
default:
return ArgType::Invalid();
}
if (CS.isIntArg())
switch (LM.getKind()) {
case LengthModifier::AsLongDouble:
// GNU extension.
return Ctx.LongLongTy;
case LengthModifier::None:
return Ctx.IntTy;
case LengthModifier::AsInt32:
return ArgType(Ctx.IntTy, "__int32");
case LengthModifier::AsChar: return ArgType::AnyCharTy;
case LengthModifier::AsShort: return Ctx.ShortTy;
case LengthModifier::AsLong: return Ctx.LongTy;
case LengthModifier::AsLongLong:
case LengthModifier::AsQuad:
return Ctx.LongLongTy;
case LengthModifier::AsInt64:
return ArgType(Ctx.LongLongTy, "__int64");
case LengthModifier::AsIntMax:
return ArgType(Ctx.getIntMaxType(), "intmax_t");
case LengthModifier::AsSizeT:
// FIXME: How to get the corresponding signed version of size_t?
return ArgType();
case LengthModifier::AsInt3264:
return Ctx.getTargetInfo().getTriple().isArch64Bit()
? ArgType(Ctx.LongLongTy, "__int64")
: ArgType(Ctx.IntTy, "__int32");
case LengthModifier::AsPtrDiff:
return ArgType(Ctx.getPointerDiffType(), "ptrdiff_t");
case LengthModifier::AsAllocate:
case LengthModifier::AsMAllocate:
case LengthModifier::AsWide:
return ArgType::Invalid();
}
if (CS.isUIntArg())
switch (LM.getKind()) {
case LengthModifier::AsLongDouble:
// GNU extension.
return Ctx.UnsignedLongLongTy;
case LengthModifier::None:
return Ctx.UnsignedIntTy;
case LengthModifier::AsInt32:
return ArgType(Ctx.UnsignedIntTy, "unsigned __int32");
case LengthModifier::AsChar: return Ctx.UnsignedCharTy;
case LengthModifier::AsShort: return Ctx.UnsignedShortTy;
case LengthModifier::AsLong: return Ctx.UnsignedLongTy;
case LengthModifier::AsLongLong:
case LengthModifier::AsQuad:
return Ctx.UnsignedLongLongTy;
case LengthModifier::AsInt64:
return ArgType(Ctx.UnsignedLongLongTy, "unsigned __int64");
case LengthModifier::AsIntMax:
return ArgType(Ctx.getUIntMaxType(), "uintmax_t");
case LengthModifier::AsSizeT:
return ArgType(Ctx.getSizeType(), "size_t");
case LengthModifier::AsInt3264:
return Ctx.getTargetInfo().getTriple().isArch64Bit()
? ArgType(Ctx.UnsignedLongLongTy, "unsigned __int64")
: ArgType(Ctx.UnsignedIntTy, "unsigned __int32");
case LengthModifier::AsPtrDiff:
// FIXME: How to get the corresponding unsigned
// version of ptrdiff_t?
return ArgType();
case LengthModifier::AsAllocate:
case LengthModifier::AsMAllocate:
case LengthModifier::AsWide:
return ArgType::Invalid();
}
if (CS.isDoubleArg()) {
if (LM.getKind() == LengthModifier::AsLongDouble)
return Ctx.LongDoubleTy;
return Ctx.DoubleTy;
}
if (CS.getKind() == ConversionSpecifier::nArg) {
switch (LM.getKind()) {
case LengthModifier::None:
//.........这里部分代码省略.........