Added notion of '*' specified format width/specifiers when checking
printf format strings.  Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Carlsson for reporting this missing feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42933 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 8b3be68..2222f79 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -61,3 +61,11 @@
   printf(L"foo %d",2); // expected-warning {{should not be a wide string}}
   vasprintf(&b,L"bar %d",2); // expected-warning {{should not be a wide string}}
 }
+
+void check_asterisk_precision_width(int x) {
+  printf("%*d"); // expected-warning {{'*' specified field width is missing a matching 'int' argument}}
+  printf("%.*d"); // expected-warning {{'.*' specified field precision is missing a matching 'int' argument}}
+  printf("%*d",12,x); // no-warning
+  printf("%*d","foo",x); // expected-warning {{field width should have type 'int', but argument has type 'char *'}}
+  printf("%.*d","foo",x); // expected-warning {{field precision should have type 'int', but argument has type 'char *'}}
+}
\ No newline at end of file