Add test case to show that Clang now checks the format string
arguments of asprintf (<rdar://problem/6657191>).
llvm-svn: 96319
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 8c2788d..f1fa658 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -183,10 +183,13 @@
printf("%0s", p); // expected-warning{{flag '0' results in undefined behavior in 's' conversion specifier}}
}
-void test12() {
+void test12(char *b) {
unsigned char buf[4];
printf ("%.4s\n", buf); // no-warning
printf ("%.4s\n", &buf); // expected-warning{{conversion specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
+
+ // Verify that we are checking asprintf
+ asprintf(&b, "%d", "asprintf"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
}
typedef struct __aslclient *aslclient;