Reverted commits 333390, 333391 and 333394

Build of shared library LLVMDemangle.so fails due to dependency problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Serge Pavlov
2018-05-29 07:05:41 +00:00
parent 79428ba469
commit d3b4e81711
12 changed files with 85 additions and 77 deletions
+15 -5
View File
@@ -32,7 +32,9 @@ void SmallPtrSetImplBase::shrink_and_clear() {
NumNonEmpty = NumTombstones = 0;
// Install the new array. Clear all the buckets to empty.
CurArray = (const void**)safe_malloc(sizeof(void*) * CurArraySize);
CurArray = (const void**)malloc(sizeof(void*) * CurArraySize);
if (CurArray == nullptr)
report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed.");
memset(CurArray, -1, CurArraySize*sizeof(void*));
}
@@ -98,7 +100,9 @@ void SmallPtrSetImplBase::Grow(unsigned NewSize) {
bool WasSmall = isSmall();
// Install the new array. Clear all the buckets to empty.
const void **NewBuckets = (const void**) safe_malloc(sizeof(void*) * NewSize);
const void **NewBuckets = (const void**) malloc(sizeof(void*) * NewSize);
if (NewBuckets == nullptr)
report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed.");
// Reset member only if memory was allocated successfully
CurArray = NewBuckets;
@@ -128,7 +132,9 @@ SmallPtrSetImplBase::SmallPtrSetImplBase(const void **SmallStorage,
CurArray = SmallArray;
// Otherwise, allocate new heap space (unless we were the same size)
} else {
CurArray = (const void**)safe_malloc(sizeof(void*) * that.CurArraySize);
CurArray = (const void**)malloc(sizeof(void*) * that.CurArraySize);
if (CurArray == nullptr)
report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed.");
}
// Copy over the that array.
@@ -157,12 +163,16 @@ void SmallPtrSetImplBase::CopyFrom(const SmallPtrSetImplBase &RHS) {
// Otherwise, allocate new heap space (unless we were the same size)
} else if (CurArraySize != RHS.CurArraySize) {
if (isSmall())
CurArray = (const void**)safe_malloc(sizeof(void*) * RHS.CurArraySize);
CurArray = (const void**)malloc(sizeof(void*) * RHS.CurArraySize);
else {
const void **T = (const void**)safe_realloc(CurArray,
const void **T = (const void**)realloc(CurArray,
sizeof(void*) * RHS.CurArraySize);
if (!T)
free(CurArray);
CurArray = T;
}
if (CurArray == nullptr)
report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed.");
}
CopyHelper(RHS);