MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)

llvm-svn: 217196
This commit is contained in:
Hans Wennborg
2014-09-04 21:39:52 +00:00
parent 68f42b9515
commit 1b23158ce4
4 changed files with 42 additions and 2 deletions

View File

@@ -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;