[PATCH] D17941: add fix-its for format-security warnings

Bob Wilson via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 14:24:00 PST 2016


bob.wilson created this revision.
bob.wilson added reviewers: bcraig, rjmccall, dblaikie.
bob.wilson added a subscriber: cfe-commits.
Herald added a subscriber: mcrosier.

The format-security warning is a special case of format-nonliteral that applies when there are no arguments besides the format string. In those cases, for printf and NSLog-style functions, there is an easy fix to provide a literal format string of "%s" (or @"%@" for Objective-C), with the nonliteral string as the argument. This patch teaches clang to provide fix-its for those cases.

http://reviews.llvm.org/D17941

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/format-strings-fixit.c
  test/SemaObjC/format-strings-objc-fixit.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17941.49995.patch
Type: text/x-patch
Size: 4083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160307/3d70de78/attachment.bin>


More information about the cfe-commits mailing list