diff options
author | Tom Care <tcare@apple.com> | 2010-06-21 21:21:01 +0000 |
---|---|---|
committer | Tom Care <tcare@apple.com> | 2010-06-21 21:21:01 +0000 |
commit | 45f9b7e8f23072d662ee1cc758f4ecb0da5e3322 (patch) | |
tree | 73b4049dfa158b84b5c621d6a63459739041d482 /test/Sema/format-strings-fixit.c | |
parent | 7e70fb217dcdf96faf34df3e197c3831c86f8089 (diff) |
Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377
Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases
M test/Sema/format-strings.c
M test/Sema/format-strings-fixit.c
M lib/Frontend/TextDiagnosticPrinter.cpp
M lib/Sema/SemaChecking.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings-fixit.c')
-rw-r--r-- | test/Sema/format-strings-fixit.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/Sema/format-strings-fixit.c b/test/Sema/format-strings-fixit.c index f74ce4e81a..7cd76c7c37 100644 --- a/test/Sema/format-strings-fixit.c +++ b/test/Sema/format-strings-fixit.c @@ -1,9 +1,6 @@ // 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 @@ -26,9 +23,10 @@ void test() { printf("%1d", (long double) 1.23); // Flag handling - printf("%0+s", (unsigned) 31337); // flags should stay - printf("%0f", "test"); // flag should be removed + printf("%0+s", (unsigned) 31337); // 0 flag should stay printf("%#p", (void *) 0); + printf("% +f", 1.23); // + flag should stay + printf("%0-f", 1.23); // - flag should stay // Positional arguments printf("%1$f:%2$.*3$f:%4$.*3$f\n", 1, 2, 3, 4); |