aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings-fixit.c
diff options
context:
space:
mode:
authorTom Care <tcare@apple.com>2010-06-18 03:02:16 +0000
committerTom Care <tcare@apple.com>2010-06-18 03:02:16 +0000
commit4c6021995032a898fb0502d5d1fd2df37638e57b (patch)
tree976728e47b1c21c39f913889a796575df60c2fc7 /test/Sema/format-strings-fixit.c
parent23d90f90413ff1efd7e4410d28ae2cab99af1fdb (diff)
Printf format strings: Added some more tests and fixed some minor bugs.
- Precision toStrings shouldn't print a dot when they have no value. - Length of char length modifier is now returned correctly. - Added several fixit tests. Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now. M test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings-fixit.c')
-rw-r--r--test/Sema/format-strings-fixit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/format-strings-fixit.c b/test/Sema/format-strings-fixit.c
index 84f69f059e..f74ce4e81a 100644
--- a/test/Sema/format-strings-fixit.c
+++ b/test/Sema/format-strings-fixit.c
@@ -1,6 +1,9 @@
// RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t
+// XFAIL: *
+// FIXME: Some of these tests currently fail due to a bug in the HighlightRange
+// function in lib/Frontend/TextDiagnosticPrinter.cpp.
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -25,7 +28,19 @@ void test() {
// Flag handling
printf("%0+s", (unsigned) 31337); // flags should stay
printf("%0f", "test"); // flag should be removed
+ printf("%#p", (void *) 0);
// Positional arguments
printf("%1$f:%2$.*3$f:%4$.*3$f\n", 1, 2, 3, 4);
+
+ // Precision
+ printf("%10.5d", 1l); // (bug 7394)
+ printf("%.2c", 'a');
+
+ // Ignored flags
+ printf("%0-f", 1.23);
+
+ // Bad length modifiers
+ printf("%hhs", "foo");
+ printf("%1$zp", (void *)0);
}