diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-14 22:57:00 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-14 22:57:00 +0000 |
commit | 441c1d92df6dece7fdfda3846ee8c9f5a43c44e2 (patch) | |
tree | b47e333bddb01fb39775e482c72ea62e2abbeb8e /clang/lib/Analysis/PrintfFormatString.cpp | |
parent | 3eb2bb1a28a0b1f72bd5d3ca3c5f13103497063b (diff) | |
download | llvm-441c1d92df6dece7fdfda3846ee8c9f5a43c44e2.zip llvm-441c1d92df6dece7fdfda3846ee8c9f5a43c44e2.tar.gz llvm-441c1d92df6dece7fdfda3846ee8c9f5a43c44e2.tar.bz2 |
[clang] Fix handling of "%zd" format specifier
This diff addresses FIXME in lib/Analysis/PrintfFormatString.cpp
and makes PrintfSpecifier::getArgType return the correct type.
In particular, this change enables Clang to emit a warning on
incorrect using of "%zd"/"%zn" format specifiers.
Differential revision: https://reviews.llvm.org/D35427
Test plan: make check-all
llvm-svn: 308067
Diffstat (limited to 'clang/lib/Analysis/PrintfFormatString.cpp')
-rw-r--r-- | clang/lib/Analysis/PrintfFormatString.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp index 6055669..50a3aa2 100644 --- a/clang/lib/Analysis/PrintfFormatString.cpp +++ b/clang/lib/Analysis/PrintfFormatString.cpp @@ -466,8 +466,7 @@ ArgType PrintfSpecifier::getArgType(ASTContext &Ctx, 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(); + return ArgType(Ctx.getSignedSizeType(), "ssize_t"); case LengthModifier::AsInt3264: return Ctx.getTargetInfo().getTriple().isArch64Bit() ? ArgType(Ctx.LongLongTy, "__int64") @@ -537,7 +536,7 @@ ArgType PrintfSpecifier::getArgType(ASTContext &Ctx, case LengthModifier::AsIntMax: return ArgType::PtrTo(ArgType(Ctx.getIntMaxType(), "intmax_t")); case LengthModifier::AsSizeT: - return ArgType(); // FIXME: ssize_t + return ArgType::PtrTo(ArgType(Ctx.getSignedSizeType(), "ssize_t")); case LengthModifier::AsPtrDiff: return ArgType::PtrTo(ArgType(Ctx.getPointerDiffType(), "ptrdiff_t")); case LengthModifier::AsLongDouble: |