Reduce false positives in printf/scanf format checker
authorAndy Gibbs <andyg1001@hotmail.co.uk>
Fri, 26 Feb 2016 15:35:16 +0000 (15:35 +0000)
committerAndy Gibbs <andyg1001@hotmail.co.uk>
Fri, 26 Feb 2016 15:35:16 +0000 (15:35 +0000)
commit9a31b3b07a95e000a7b6689223dce8322d563265
tree47d1bed7acf7e02d09cd1304fe57c3e55cc0c5c5
parent0d5e9d3135f3f7784ca8c708699b324a644b97c7
Reduce false positives in printf/scanf format checker

Summary:
The printf/scanf format checker is a little over-zealous in handling the conditional operator.  This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment:

printf(minimal ? "%i\n" : "%i: %s\n", code, msg);

Reviewers: rtrieu

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15636

llvm-svn: 262025
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/format-strings-scanf.c
clang/test/Sema/format-strings.c