aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-11-27 02:37:49 +0000
committerJordan Rose <jordan_rose@apple.com>2012-11-27 02:37:49 +0000
commit6e99f9f56f320818d814a5474d76a2849e037c55 (patch)
tree4741b6bc307c9509a769c067914527cd23951c27
parentec351f169dd608e566018829f4441ea18688ef38 (diff)
[analyzer] Fix test to work on non-LP64 systems.
Thanks for the original catch in r168303, Takumi. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168671 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/malloc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 615c5a43d1..3e5f914e9d 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,debug.ExprInspection -analyzer-store=region -verify %s
-// REQUIRES: LP64
#include "Inputs/system-header-simulator.h"
@@ -947,20 +946,24 @@ void localStructTest() {
pSt->memP = malloc(12);
} // expected-warning{{Memory is never released; potential leak}}
+#ifdef __INTPTR_TYPE__
// Test double assignment through integers.
-static long glob;
+typedef __INTPTR_TYPE__ intptr_t;
+typedef unsigned __INTPTR_TYPE__ uintptr_t;
+
+static intptr_t glob;
void test_double_assign_ints()
{
void *ptr = malloc (16); // no-warning
- glob = (long)(unsigned long)ptr;
+ glob = (intptr_t)(uintptr_t)ptr;
}
void test_double_assign_ints_positive()
{
void *ptr = malloc(16);
- (void*)(long)(unsigned long)ptr; // expected-warning {{unused}}
+ (void*)(intptr_t)(uintptr_t)ptr; // expected-warning {{unused}}
} // expected-warning {{leak}}
-
+#endif
void testCGContextNoLeak()
{