Author: zaks
Date: Thu Apr 5 20:00:47 2012
New Revision: 154156
URL: http://llvm.org/viewvc/llvm-project?rev=154156&view=rev
Log:
[analyzer]Fix false positive: pointer might escape through CG*WithData.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
cfe/trunk/test/Analysis/malloc.mm
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h?rev=154156&r1=154155&r2=154156&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h Thu
Apr 5 20:00:47 2012
@@ -278,6 +278,7 @@
if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
+ StrInStrNoCase(FName, "WithData") != StringRef::npos ||
StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
return true;
Modified: cfe/trunk/test/Analysis/malloc.mm
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.mm?rev=154156&r1=154155&r2=154156&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.mm (original)
+++ cfe/trunk/test/Analysis/malloc.mm Thu Apr 5 20:00:47 2012
@@ -136,3 +136,21 @@
OSAtomicEnqueue(pool, newItem, 4);
}
+// Pointer might escape through CGDataProviderCreateWithData
(radar://11187558).
+typedef struct CGDataProvider *CGDataProviderRef;
+typedef void (*CGDataProviderReleaseDataCallback)(void *info, const void *data,
+ size_t size);
+extern CGDataProviderRef CGDataProviderCreateWithData(void *info,
+ const void *data, size_t size,
+ CGDataProviderReleaseDataCallback releaseData)
+ __attribute__((visibility("default")));
+void *calloc(size_t, size_t);
+
+static void releaseDataCallback (void *info, const void *data, size_t size) {
+#pragma unused (info, size)
+ free((void*)data);
+}
+void testCGDataProviderCreateWithData() {
+ void* b = calloc(8, 8);
+ CGDataProviderRef p = CGDataProviderCreateWithData(0, b, 8*8,
releaseDataCallback);
+}
\ No newline at end of file
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits