From 9092c3e0fa01f3139b016d05d267a89e3b07747a Mon Sep 17 00:00:00 2001 From: rdivacky Date: Wed, 14 Oct 2009 18:03:49 +0000 Subject: Update clang to r84119. --- test/Analysis/casts.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'test/Analysis/casts.c') diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index 5e4222b..ae51ffb 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -1,9 +1,16 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region --verify %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref -analyzer-store=region --verify %s // Test if the 'storage' region gets properly initialized after it is cast to // 'struct sockaddr *'. -#include +typedef unsigned char __uint8_t; +typedef unsigned int __uint32_t; +typedef __uint32_t __darwin_socklen_t; +typedef __uint8_t sa_family_t; +typedef __darwin_socklen_t socklen_t; +struct sockaddr { sa_family_t sa_family; }; +struct sockaddr_storage {}; + void f(int sock) { struct sockaddr_storage storage; struct sockaddr* sockaddr = (struct sockaddr*)&storage; @@ -19,14 +26,14 @@ struct s { struct s *value; }; -int f1(struct s **pval) { +void f1(struct s **pval) { int *tbool = ((void*)0); struct s *t = *pval; pval = &(t->value); - tbool = (int *)pval; // Should record the cast-to type here. + tbool = (int *)pval; // use the cast-to type 'int *' to create element region. char c = (unsigned char) *tbool; // Should use cast-to type to create symbol. - if (*tbool == -1) - 3; + if (*tbool == -1) // here load the element region with the correct type 'int' + (void)3; } void f2(const char *str) { -- cgit v1.1