Do not warn about format strings that are indexed string literals.
authorStephen Hines <srhines@google.com>
Wed, 14 Sep 2016 20:05:20 +0000 (20:05 +0000)
committerStephen Hines <srhines@google.com>
Wed, 14 Sep 2016 20:05:20 +0000 (20:05 +0000)
commit0535fecc400314fa16814e0851ad74050231ec8d
tree7b91e5f8857bc576c8881f624687ff59eb6129b6
parente97d3b90b939d9a8958bb0cf8c4f38f878d6b576
Do not warn about format strings that are indexed string literals.

Summary:
The warning for a format string not being a sting literal and therefore
being potentially insecure is overly strict for indecies into sting
literals. This fix checks if the index into the string literal is
precomputable. If thats the case it will check if the suffix of that
sting literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indecies into the
string literal.

Reviewers: rsmith

Subscribers: srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D23820

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