[llvm-branch-commits] [cfe-branch] r122484 - in /cfe/branches/Apple/whitney: lib/Analysis/CocoaConventions.cpp test/Analysis/refcnt_naming.m
Daniel Dunbar
daniel at zuster.org
Wed Dec 22 21:40:38 PST 2010
Author: ddunbar
Date: Wed Dec 22 23:40:38 2010
New Revision: 122484
URL: http://llvm.org/viewvc/llvm-project?rev=122484&view=rev
Log:
Merge r122046:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Fri Dec 17 07:11:57 2010 +0000
Fix assertion failure in cocoa::deriveNamingConvention()
when the selector is the string 'mutable'.
Modified:
cfe/branches/Apple/whitney/lib/Analysis/CocoaConventions.cpp
cfe/branches/Apple/whitney/test/Analysis/refcnt_naming.m
Modified: cfe/branches/Apple/whitney/lib/Analysis/CocoaConventions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Analysis/CocoaConventions.cpp?rev=122484&r1=122483&r2=122484&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Analysis/CocoaConventions.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Analysis/CocoaConventions.cpp Wed Dec 22 23:40:38 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/branches/Apple/whitney/test/Analysis/refcnt_naming.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Analysis/refcnt_naming.m?rev=122484&r1=122483&r2=122484&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Analysis/refcnt_naming.m (original)
+++ cfe/branches/Apple/whitney/test/Analysis/refcnt_naming.m Wed Dec 22 23:40:38 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 llvm-branch-commits
mailing list