llvm-project/clang/lib
Tom Care b49ec6907b Bug 7377: Fixed several bad printf format string bugs.
- Added warning for undefined behavior when using field specifier
- Added warning for undefined behavior when using length modifier
- Fixed warnings for invalid flags
- Added warning for ignored flags
- Added fixits for the above warnings
- Fixed accuracy of detecting several undefined behavior conditions
- Receive normal warnings in addition to security warnings when using %n
- Fix bug where '+' flag would remain on unsigned conversion suggestions

Summary of changes:
- Added expanded tests
- Added/expanded warnings
- Added position info to OptionalAmounts for fixits
- Extracted optional flags to a wrapper class with position info for fixits
- Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior
- Fixed conversion specifier checking to conform to C99 standard
- Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier

Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly.

M    test/Sema/format-strings.c
M    include/clang/Basic/DiagnosticSemaKinds.td
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp
M    lib/Sema/SemaChecking.cpp

llvm-svn: 106233
2010-06-17 19:00:27 +00:00
..
AST Update CMake build system for ARM NEON generation. 2010-06-17 15:17:41 +00:00
Analysis Bug 7377: Fixed several bad printf format string bugs. 2010-06-17 19:00:27 +00:00
Basic Update CMake build system for ARM NEON generation. 2010-06-17 15:17:41 +00:00
Checker Tweak stack address checker to report multiple cases where globals may reference stack memory. 2010-06-17 04:21:37 +00:00
CodeGen Mangle operator names in the Microsoft C++ Mangler. 2010-06-17 06:47:31 +00:00
Driver Update CMake build for new attribute changes. 2010-06-17 00:37:02 +00:00
Frontend Update CMake build for new attribute changes. 2010-06-17 00:37:02 +00:00
Headers Update CMake build system for ARM NEON generation. 2010-06-17 15:17:41 +00:00
Index Simplify libIndex Makefile, which doesn't need to worry about altivec support. 2010-06-08 20:57:18 +00:00
Lex Remove a dead argument to ProcessUCNEscape. 2010-06-15 18:06:43 +00:00
Parse Make sure the caching mechanism in Parser::ParseLexedMethodDefs is robust against the parser reading too few tokens. 2010-06-17 10:52:22 +00:00
Rewrite Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration 2010-06-15 17:48:49 +00:00
Runtime Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile. 2010-06-08 20:34:18 +00:00
Sema Bug 7377: Fixed several bad printf format string bugs. 2010-06-17 19:00:27 +00:00
CMakeLists.txt Split libAnalysis into two libraries: libAnalysis and libChecker. 2010-01-25 04:41:41 +00:00
Makefile Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile. 2010-06-08 20:34:18 +00:00