[PATCH] D23236: When ARC is enabled, no warning will be generated when a method1. Returns 'nil' in a method that is attributed to return a 'nonnull'2. The return-statement is a ConditionalOperator, where the lhs is nil and rhs an objC-method-call (or the other...
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 8 17:26:26 PDT 2016
dcoughlin added inline comments.
================
Comment at: test/Analysis/nullability.mm:114
@@ -112,1 +113,3 @@
+NSString *_Nonnull testNullReturnInTernaryOperator(int x) {
+ return x > 3 ? nil : [@"" stringByAppendingString:@""]; // expected-warning {{Null is returned from a function that is expected to return a non-null value}}
----------------
I think a better file for these two analyzer tests is Analysis/nullability_nullonly.mm because they check for flows of nil to _Nonnull and not _Nullable to _Nonnull. Also, you shouldn't need to add an extra RUN line there.
Long-term these analyzer nullability test files need to be merged, but for this change I think sticking the two added tests in nullability_nullonly.mm is the best option.
https://reviews.llvm.org/D23236
More information about the cfe-commits
mailing list