diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-31 01:34:06 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-31 01:34:06 +0000 |
commit | d76e1cd8276f377c602b8370c7a61dfa7c34c764 (patch) | |
tree | 867a2505d581734901bf91fd4ad9e21232ef9be2 /test/ARCMT | |
parent | d786f1a6331246e7d0eedde277f126ab92089eeb (diff) |
[arcmt] When fixing the "unassigned init call" ARC error, make sure
to do a nil check for the result of the call.
rdar://10950973
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r-- | test/ARCMT/init.m | 2 | ||||
-rw-r--r-- | test/ARCMT/init.m.result | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/test/ARCMT/init.m b/test/ARCMT/init.m index 36e5148476..9dbb1f82b8 100644 --- a/test/ARCMT/init.m +++ b/test/ARCMT/init.m @@ -3,6 +3,8 @@ // RUN: diff %t %s.result // DISABLE: mingw32 +#define nil (void *)0 + @interface NSObject -init; @end diff --git a/test/ARCMT/init.m.result b/test/ARCMT/init.m.result index 9f568d83ed..d7f730083a 100644 --- a/test/ARCMT/init.m.result +++ b/test/ARCMT/init.m.result @@ -3,6 +3,8 @@ // RUN: diff %t %s.result // DISABLE: mingw32 +#define nil (void *)0 + @interface NSObject -init; @end @@ -16,7 +18,7 @@ @implementation A -(id) init { - self = [self init]; + if (!(self = [self init])) return nil; id a; [a init]; a = [[A alloc] init]; @@ -25,7 +27,7 @@ } -(id) init2 { - self = [super init]; + if (!(self = [super init])) return nil; return self; } |