aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CocoaConventions.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-17 07:11:57 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-17 07:11:57 +0000
commit5eef59ee77456640a2d03bb90fc717d5a43e175d (patch)
tree5531cce17fdb5eb108666097cc143eb09367386b /lib/Analysis/CocoaConventions.cpp
parentb321c0c0ba957d78475e72cebde4028fdaa00f8f (diff)
Fix assertion failure in cocoa::deriveNamingConvention()
when the selector is the string 'mutable'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CocoaConventions.cpp')
-rw-r--r--lib/Analysis/CocoaConventions.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Analysis/CocoaConventions.cpp b/lib/Analysis/CocoaConventions.cpp
index 9a1be3ee05..ad359aad25 100644
--- a/lib/Analysis/CocoaConventions.cpp
+++ b/lib/Analysis/CocoaConventions.cpp
@@ -98,10 +98,12 @@ cocoa::NamingConvention cocoa::deriveNamingConvention(Selector S) {
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;
}