[cfe-commits] r153702 - /cfe/trunk/test/Analysis/malloc.cpp
Anna Zaks
ganna at apple.com
Thu Mar 29 16:26:55 PDT 2012
Author: zaks
Date: Thu Mar 29 18:26:54 2012
New Revision: 153702
URL: http://llvm.org/viewvc/llvm-project?rev=153702&view=rev
Log:
[analyzer] Add a malloc cpp test file.
Includes a test from a reported false positive fixed in some earlier
commit.
Added:
cfe/trunk/test/Analysis/malloc.cpp
Added: cfe/trunk/test/Analysis/malloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.cpp?rev=153702&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/malloc.cpp (added)
+++ cfe/trunk/test/Analysis/malloc.cpp Thu Mar 29 18:26:54 2012
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.core.CastSize,unix.Malloc -analyzer-store=region -verify %s
+
+typedef __typeof(sizeof(int)) size_t;
+void *malloc(size_t);
+void free(void *);
+void *realloc(void *ptr, size_t size);
+void *calloc(size_t nmemb, size_t size);
+
+// Test for radar://11110132.
+struct Foo {
+ mutable void* m_data;
+ Foo(void* data) : m_data(data) {}
+};
+Foo aFunction() {
+ return malloc(10);
+}
More information about the cfe-commits
mailing list