Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.

llvm-svn: 94867
This commit is contained in:
Ted Kremenek 2010-01-30 01:02:18 +00:00
parent e057403835
commit 9ff02052dd
2 changed files with 4 additions and 0 deletions

View File

@ -309,6 +309,9 @@ ArgTypeResult FormatSpecifier::getArgType(ASTContext &Ctx) const {
// version of ptrdiff_t? // version of ptrdiff_t?
return ArgTypeResult(); return ArgTypeResult();
} }
if (CS.isDoubleArg())
return Ctx.DoubleTy;
// FIXME: Handle other cases. // FIXME: Handle other cases.
return ArgTypeResult(); return ArgTypeResult();

View File

@ -160,6 +160,7 @@ void test10(int x, float f, int i) {
printf("%"); // expected-warning{{incomplete format specifier}} printf("%"); // expected-warning{{incomplete format specifier}}
printf("%.d", x); // no-warning printf("%.d", x); // no-warning
printf("%.", x); // expected-warning{{incomplete format specifier}} printf("%.", x); // expected-warning{{incomplete format specifier}}
printf("%f", 4); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
} }
typedef struct __aslclient *aslclient; typedef struct __aslclient *aslclient;