aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2011-10-27 08:29:09 +0000
committerHans Wennborg <hans@hanshq.net>2011-10-27 08:29:09 +0000
commit29e97cb35fab314388f62b68fefa78947e93c1dc (patch)
treeef30883ed59f503100b456acf04d5f319e176cea /lib/Analysis
parent98a9203d80b6a5ff90edf037b1595f553fc81b15 (diff)
Teach format string analysis that "%zu" means size_t.
The code had it backwards, thinking size_t was signed, and using that for "%zd". Also let the analysis get the types for (u)intmax_t while we are at it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/PrintfFormatString.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 7347dca3c2..70dbfd30ce 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -301,10 +301,10 @@ ArgTypeResult PrintfSpecifier::getArgType(ASTContext &Ctx) const {
case LengthModifier::AsShort: return Ctx.ShortTy;
case LengthModifier::AsLong: return Ctx.LongTy;
case LengthModifier::AsLongLong: return Ctx.LongLongTy;
- case LengthModifier::AsIntMax:
- // FIXME: Return unknown for now.
+ case LengthModifier::AsIntMax: return Ctx.getIntMaxType();
+ case LengthModifier::AsSizeT:
+ // FIXME: How to get the corresponding signed version of size_t?
return ArgTypeResult();
- case LengthModifier::AsSizeT: return Ctx.getSizeType();
case LengthModifier::AsPtrDiff: return Ctx.getPointerDiffType();
}
@@ -317,13 +317,9 @@ ArgTypeResult PrintfSpecifier::getArgType(ASTContext &Ctx) const {
case LengthModifier::AsShort: return Ctx.UnsignedShortTy;
case LengthModifier::AsLong: return Ctx.UnsignedLongTy;
case LengthModifier::AsLongLong: return Ctx.UnsignedLongLongTy;
- case LengthModifier::AsIntMax:
- // FIXME: Return unknown for now.
- return ArgTypeResult();
+ case LengthModifier::AsIntMax: return Ctx.getUIntMaxType();
case LengthModifier::AsSizeT:
- // FIXME: How to get the corresponding unsigned
- // version of size_t?
- return ArgTypeResult();
+ return Ctx.getSizeType();
case LengthModifier::AsPtrDiff:
// FIXME: How to get the corresponding unsigned
// version of ptrdiff_t?