diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2018-02-15 09:45:59 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2018-02-15 09:45:59 +0000 |
commit | 4500001905805be5437cfe21e9f65820202c8966 (patch) | |
tree | 93ba69588b99c6008de5d6306d91c0a9ddf0feae /llvm/lib/Support/StringMap.cpp | |
parent | ce719a0def0054c03a9787ddb5a1e0235bbea103 (diff) | |
download | bcm5719-llvm-4500001905805be5437cfe21e9f65820202c8966.tar.gz bcm5719-llvm-4500001905805be5437cfe21e9f65820202c8966.zip |
Revert r325224 "Report fatal error in the case of out of memory"
It caused fails on some buildbots.
llvm-svn: 325227
Diffstat (limited to 'llvm/lib/Support/StringMap.cpp')
-rw-r--r-- | llvm/lib/Support/StringMap.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp index 4a985b06838..4341da2d97b 100644 --- a/llvm/lib/Support/StringMap.cpp +++ b/llvm/lib/Support/StringMap.cpp @@ -57,9 +57,10 @@ void StringMapImpl::init(unsigned InitSize) { NumItems = 0; NumTombstones = 0; - TheTable = static_cast<StringMapEntryBase **>( - std::calloc(NewNumBuckets+1, - sizeof(StringMapEntryBase **) + sizeof(unsigned))); + TheTable = (StringMapEntryBase **)calloc(NewNumBuckets+1, + sizeof(StringMapEntryBase **) + + sizeof(unsigned)); + if (TheTable == nullptr) report_bad_alloc_error("Allocation of StringMap table failed."); @@ -218,8 +219,10 @@ unsigned StringMapImpl::RehashTable(unsigned BucketNo) { unsigned NewBucketNo = BucketNo; // Allocate one extra bucket which will always be non-empty. This allows the // iterators to stop at end. - StringMapEntryBase **NewTableArray = static_cast<StringMapEntryBase **>( - std::calloc(NewSize+1, sizeof(StringMapEntryBase *) + sizeof(unsigned))); + StringMapEntryBase **NewTableArray = + (StringMapEntryBase **)calloc(NewSize+1, sizeof(StringMapEntryBase *) + + sizeof(unsigned)); + if (NewTableArray == nullptr) report_bad_alloc_error("Allocation of StringMap hash table failed."); |