forked from OSchip/llvm-project
Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.
llvm-svn: 94867
This commit is contained in:
parent
e057403835
commit
9ff02052dd
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue