[cfe-commits] Patch for PR 102754/10275: format attribute gnore on obj-c methods and other cases

Jean-Daniel Dupas devlists at shadowlab.org
Tue Jan 17 01:18:25 PST 2012


I found a little issue.

I was too much optimistic about CFString handling. Constant CFString are not string literals for clang, so trying to check them produce false diagnostic.
I removed CFString from the list of supported format.

Le 17 janv. 2012 à 06:31, Ted Kremenek a écrit :

> This looks great to me.
> On Monday, January 16, 2012 at 11:42 AM, Jean-Daniel Dupas wrote:
> 
>> Le 14 janv. 2012 à 23:59, Jean-Daniel Dupas a écrit :
>> 
>>> Hello,
>>> 
>>> Here is a patch to fix 2 issues:
>>> - format strings attributes are not checked on obj-c methods.
>>> - format attribute using NSString and CFString format are not checked at all.
>>> 
>>> This patch add a CheckObjCMethodCall() member to Sema that mirrors CheckFunctionCall() but work for obj-c method call and not function call.
>>> 
>>> To match the CheckFunctionCall() function, this new function handle "format" attributes (which was not handled yet), and "non null" attributes (which was previously handled in SemaObjC).
>>> 
>>> The second issue is that CheckablePrintfAttr() return true only if the format is printf, but should also returns true for NSString and CFString formats.
>>> 
>>> Please, can somebody review it, and apply it if it is fine.
>>> Thanks.
>> 
>> A second version of the patch.
>> 
>> Format attribute checking logic was copied at 3 places:
>> - in function call checking.
>> - in block call checking.
>> - in method call checking.
>> 
>> This new version of the patch factorizes the format checking logic in a single place: CheckFormatArguments()
>> It also fixes an inconsistency between CheckablePrintfAttr() and CheckPrintfScanfArguments().
>> The test to define if the attribute index should be shifted (if this is a C++ instance member call) was not correct in the former.
>> This test is now performed once.
>> 
>> Please, can somebody review it.
>> Thanks
>> 
>> -- Jean-Daniel
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 
>> Attachments:
>> - objc-format.patch
> 

-- Jean-Daniel



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120117/72437a4b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objc-format.patch
Type: application/octet-stream
Size: 21169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120117/72437a4b/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120117/72437a4b/attachment-0001.html>


More information about the cfe-commits mailing list