[cfe-commits] r122046 - in /cfe/trunk: lib/Analysis/CocoaConventions.cpp test/Analysis/refcnt_naming.m
Ted Kremenek
kremenek at apple.com
Thu Dec 16 23:11:57 PST 2010
Author: kremenek
Date: Fri Dec 17 01:11:57 2010
New Revision: 122046
URL: http://llvm.org/viewvc/llvm-project?rev=122046&view=rev
Log:
Fix assertion failure in cocoa::deriveNamingConvention()
when the selector is the string 'mutable'.
Modified:
cfe/trunk/lib/Analysis/CocoaConventions.cpp
cfe/trunk/test/Analysis/refcnt_naming.m
Modified: cfe/trunk/lib/Analysis/CocoaConventions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CocoaConventions.cpp?rev=122046&r1=122045&r2=122046&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CocoaConventions.cpp (original)
+++ cfe/trunk/lib/Analysis/CocoaConventions.cpp Fri Dec 17 01:11:57 2010
@@ -98,10 +98,12 @@
if (memcmp(s, "mutable", 7) == 0) {
// Look at the next word to see if it is "Copy".
s = wordEnd;
- wordEnd = parseWord(s);
- len = wordEnd - s;
- if (len == 4 && memcmp(s, "Copy", 4) == 0)
- return CreateRule;
+ if (*s != '\0') {
+ wordEnd = parseWord(s);
+ len = wordEnd - s;
+ if (len == 4 && memcmp(s, "Copy", 4) == 0)
+ return CreateRule;
+ }
}
return NoConvention;
}
Modified: cfe/trunk/test/Analysis/refcnt_naming.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/refcnt_naming.m?rev=122046&r1=122045&r2=122046&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/refcnt_naming.m (original)
+++ cfe/trunk/test/Analysis/refcnt_naming.m Fri Dec 17 01:11:57 2010
@@ -13,6 +13,8 @@
@interface NamingTest : NSObject {}
-(NSObject*)copyPhoto;
-(NSObject*)mutableCopyPhoto;
+-(NSObject*)mutable;
+-(NSObject*)mutableCopying;
-(NSObject*)photocopy; // read as "photocopy"
-(NSObject*)photoCopy; // read as "photo Copy"
-(NSObject*)__blebPRCopy; // read as "bleb PRCopy"
@@ -49,6 +51,8 @@
void testNames(NamingTest* x) {
[x copyPhoto]; // expected-warning{{leak}}
[x mutableCopyPhoto]; // expected-warning{{leak}}
+ [x mutable]; // no-warning
+ [x mutableCopying]; // no-warning
[x photocopy]; // no-warning
[x photoCopy]; // no-warning
[x __blebPRCopy]; // no-warning
More information about the cfe-commits
mailing list