From e54f64899fbaaa95fc3241236aabfaa37003a658 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 7 Mar 2011 19:38:38 +0000 Subject: [PATCH] Often GCC can see that NumBuckets is zero here, resulting in a warning about possibly swapped memset parameters. Avoid the warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127170 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/DenseMap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index dd341c6a751..9d2b11d6b2b 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -72,7 +72,8 @@ public: P->first.~KeyT(); } #ifndef NDEBUG - memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets); + if (NumBuckets) + memset(Buckets, 0x5a, sizeof(BucketT)*NumBuckets); #endif operator delete(Buckets); }