forked from OSchip/llvm-project
Add format string type checking support for 'long double'.
llvm-svn: 95026
This commit is contained in:
parent
5b66b31774
commit
016b605266
|
@ -311,8 +311,11 @@ ArgTypeResult FormatSpecifier::getArgType(ASTContext &Ctx) const {
|
|||
return ArgTypeResult();
|
||||
}
|
||||
|
||||
if (CS.isDoubleArg())
|
||||
if (CS.isDoubleArg()) {
|
||||
if (LM == AsLongDouble)
|
||||
return Ctx.LongDoubleTy;
|
||||
return Ctx.DoubleTy;
|
||||
}
|
||||
|
||||
// FIXME: Handle other cases.
|
||||
return ArgTypeResult();
|
||||
|
|
|
@ -167,6 +167,8 @@ void test10(int x, float f, int i, long long lli) {
|
|||
// This is fine, because there is an implicit conversion to an int.
|
||||
printf("%d", (unsigned char) 10); // no-warning
|
||||
printf("%d", (long long) 10); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
|
||||
printf("%Lf\n", (long double) 1.0); // no-warning
|
||||
printf("%f\n", (long double) 1.0); // expected-warning{{conversion specifies type 'double' but the argument has type 'long double'}}
|
||||
}
|
||||
|
||||
typedef struct __aslclient *aslclient;
|
||||
|
|
Loading…
Reference in New Issue