MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)
llvm-svn: 217196
This commit is contained in:
@@ -266,10 +266,14 @@ ArgType PrintfSpecifier::getArgType(ASTContext &Ctx,
|
||||
|
||||
if (CS.getKind() == ConversionSpecifier::cArg)
|
||||
switch (LM.getKind()) {
|
||||
case LengthModifier::None: return Ctx.IntTy;
|
||||
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;
|
||||
default:
|
||||
return ArgType::Invalid();
|
||||
}
|
||||
@@ -395,10 +399,16 @@ ArgType PrintfSpecifier::getArgType(ASTContext &Ctx,
|
||||
if (IsObjCLiteral)
|
||||
return ArgType(Ctx.getPointerType(Ctx.UnsignedShortTy.withConst()),
|
||||
"const unichar *");
|
||||
if (Ctx.getTargetInfo().getTriple().isOSMSVCRT() &&
|
||||
LM.getKind() == LengthModifier::AsShort)
|
||||
return ArgType::CStrTy;
|
||||
return ArgType(ArgType::WCStrTy, "wchar_t *");
|
||||
case ConversionSpecifier::CArg:
|
||||
if (IsObjCLiteral)
|
||||
return ArgType(Ctx.UnsignedShortTy, "unichar");
|
||||
if (Ctx.getTargetInfo().getTriple().isOSMSVCRT() &&
|
||||
LM.getKind() == LengthModifier::AsShort)
|
||||
return Ctx.IntTy;
|
||||
return ArgType(Ctx.WideCharTy, "wchar_t");
|
||||
case ConversionSpecifier::pArg:
|
||||
return ArgType::CPointerTy;
|
||||
|
||||
Reference in New Issue
Block a user