r332136 - [analyzer] Ignore the nullability quantifiers for autoreleasewritechecker

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 13:39:19 PDT 2018


Author: george.karpenkov
Date: Fri May 11 13:39:19 2018
New Revision: 332136

URL: http://llvm.org/viewvc/llvm-project?rev=332136&view=rev
Log:
[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
    cfe/trunk/test/Analysis/autoreleasewritechecker_test.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp?rev=332136&r1=332135&r2=332136&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp Fri May 11 13:39:19 2018
@@ -160,8 +160,8 @@ void ObjCAutoreleaseWriteChecker::checkA
   ));
 
   auto DoublePointerParamM =
-      parmVarDecl(hasType(pointerType(
-                      pointee(hasCanonicalType(objcObjectPointerType())))))
+      parmVarDecl(hasType(hasCanonicalType(pointerType(
+                      pointee(hasCanonicalType(objcObjectPointerType()))))))
           .bind(ParamBind);
 
   auto HasParamAndWritesAsyncM = allOf(

Modified: cfe/trunk/test/Analysis/autoreleasewritechecker_test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/autoreleasewritechecker_test.m?rev=332136&r1=332135&r2=332136&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/autoreleasewritechecker_test.m (original)
+++ cfe/trunk/test/Analysis/autoreleasewritechecker_test.m Fri May 11 13:39:19 2018
@@ -204,4 +204,11 @@ BOOL writeToErrorWithIterator(NSError *_
     }];
   return 0;
 }
+
+void writeToErrorWithIteratorNonnull(NSError *__autoreleasing* _Nonnull error, NSDictionary *a) {
+  [a enumerateKeysAndObjectsUsingBlock:^{
+     *error = [NSError errorWithDomain:1]; // expected-warning{{Write to autoreleasing out parameter}}
+  }];
+}
 #endif
+




More information about the cfe-commits mailing list