[cfe-commits] r48917 - /cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
Ted Kremenek
kremenek at apple.com
Fri Mar 28 09:09:39 PDT 2008
Author: kremenek
Date: Fri Mar 28 11:09:38 2008
New Revision: 48917
URL: http://llvm.org/viewvc/llvm-project?rev=48917&view=rev
Log:
Added skeleton checking for NSString's method initWithFormat: (do not pass nil). This won't be useful in most cases right now
because the analyzer isn't tracking expected types for an object, and [NSString alloc] just runs "id".
Modified:
cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
Modified: cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp?rev=48917&r1=48916&r2=48917&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicObjCFoundationChecks.cpp Fri Mar 28 11:09:38 2008
@@ -209,12 +209,21 @@
switch (len) {
default:
break;
- case 8:
-
+ case 8:
if (!strcmp(cstr, "compare:"))
return CheckNilArg(N, 0);
break;
+
+ case 15:
+ // FIXME: Checking for initWithFormat: will not work in most cases
+ // yet because [NSString alloc] returns id, not NSString*. We will
+ // need support for tracking expected-type information in the analyzer
+ // to find these errors.
+ if (!strcmp(cstr, "initWithFormat:"))
+ return CheckNilArg(N, 0);
+
+ break;
case 16:
if (!strcmp(cstr, "compare:options:"))
@@ -234,7 +243,7 @@
return CheckNilArg(N, 0);
break;
-
+
case 29:
if (!strcmp(cstr, "compare:options:range:locale:"))
return CheckNilArg(N, 0);
More information about the cfe-commits
mailing list