From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Analysis/malloc.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 clang/test/Analysis/malloc.cpp (limited to 'clang/test/Analysis/malloc.cpp') diff --git a/clang/test/Analysis/malloc.cpp b/clang/test/Analysis/malloc.cpp new file mode 100644 index 0000000..8f80b2b --- /dev/null +++ b/clang/test/Analysis/malloc.cpp @@ -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); +} -- cgit v1.2.3