[llvm] r325227 - Revert r325224 "Report fatal error in the case of out of memory"

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 01:45:59 PST 2018


Author: sepavloff
Date: Thu Feb 15 01:45:59 2018
New Revision: 325227

URL: http://llvm.org/viewvc/llvm-project?rev=325227&view=rev
Log:
Revert r325224 "Report fatal error in the case of out of memory"

It caused fails on some buildbots.

Modified:
    llvm/trunk/include/llvm/ADT/BitVector.h
    llvm/trunk/include/llvm/ADT/SparseMultiSet.h
    llvm/trunk/include/llvm/ADT/SparseSet.h
    llvm/trunk/include/llvm/Support/Allocator.h
    llvm/trunk/include/llvm/Support/ErrorHandling.h
    llvm/trunk/include/llvm/Support/OnDiskHashTable.h
    llvm/trunk/lib/CodeGen/InterferenceCache.cpp
    llvm/trunk/lib/CodeGen/LiveIntervalUnion.cpp
    llvm/trunk/lib/CodeGen/RegisterPressure.cpp
    llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
    llvm/trunk/lib/Object/Object.cpp
    llvm/trunk/lib/Support/ErrorHandling.cpp
    llvm/trunk/lib/Support/FoldingSet.cpp
    llvm/trunk/lib/Support/RWMutex.cpp
    llvm/trunk/lib/Support/StringMap.cpp
    llvm/trunk/lib/Support/Unix/Signals.inc
    llvm/trunk/lib/Support/Windows/RWMutex.inc
    llvm/trunk/tools/llvm-c-test/attributes.c
    llvm/trunk/tools/llvm-c-test/echo.cpp
    llvm/trunk/unittests/Support/AllocatorTest.cpp
    llvm/trunk/unittests/Support/ManagedStatic.cpp

Modified: llvm/trunk/include/llvm/ADT/BitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/BitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/BitVector.h Thu Feb 15 01:45:59 2018
@@ -828,8 +828,7 @@ private:
   }
 
   MutableArrayRef<BitWord> allocate(size_t NumWords) {
-    BitWord *RawBits = static_cast<BitWord *>(
-        llvm::malloc(NumWords * sizeof(BitWord)));
+    BitWord *RawBits = (BitWord *)std::malloc(NumWords * sizeof(BitWord));
     return MutableArrayRef<BitWord>(RawBits, NumWords);
   }
 
@@ -868,8 +867,8 @@ private:
   void grow(unsigned NewSize) {
     size_t NewCapacity = std::max<size_t>(NumBitWords(NewSize), Bits.size() * 2);
     assert(NewCapacity > 0 && "realloc-ing zero space");
-    BitWord *NewBits = static_cast<BitWord *>(
-        llvm::realloc(Bits.data(), NewCapacity * sizeof(BitWord)));
+    BitWord *NewBits =
+        (BitWord *)std::realloc(Bits.data(), NewCapacity * sizeof(BitWord));
     Bits = MutableArrayRef<BitWord>(NewBits, NewCapacity);
     clear_unused_bits();
   }

Modified: llvm/trunk/include/llvm/ADT/SparseMultiSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseMultiSet.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseMultiSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseMultiSet.h Thu Feb 15 01:45:59 2018
@@ -211,7 +211,7 @@ public:
     // The Sparse array doesn't actually need to be initialized, so malloc
     // would be enough here, but that will cause tools like valgrind to
     // complain about branching on uninitialized data.
-    Sparse = static_cast<SparseT*>(llvm::calloc(U, sizeof(SparseT)));
+    Sparse = reinterpret_cast<SparseT*>(calloc(U, sizeof(SparseT)));
     Universe = U;
   }
 

Modified: llvm/trunk/include/llvm/ADT/SparseSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseSet.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseSet.h Thu Feb 15 01:45:59 2018
@@ -22,7 +22,6 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Allocator.h"
 #include <cassert>
 #include <cstdint>
 #include <cstdlib>
@@ -164,7 +163,7 @@ public:
     // The Sparse array doesn't actually need to be initialized, so malloc
     // would be enough here, but that will cause tools like valgrind to
     // complain about branching on uninitialized data.
-    Sparse = static_cast<SparseT*>(llvm::calloc(U, sizeof(SparseT)));
+    Sparse = reinterpret_cast<SparseT*>(calloc(U, sizeof(SparseT)));
     Universe = U;
   }
 

Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Thu Feb 15 01:45:59 2018
@@ -439,33 +439,6 @@ public:
   T *Allocate(size_t num = 1) { return Allocator.Allocate<T>(num); }
 };
 
-/// \{
-/// Counterparts of allocation functions defined in namespace 'std', which crash
-/// on allocation failure instead of returning null pointer.
-
-LLVM_ATTRIBUTE_RETURNS_NONNULL inline void *malloc(size_t Sz) {
-  void *Result = std::malloc(Sz);
-  if (Result == nullptr)
-    report_bad_alloc_error("Allocation failed.");
-  return Result;
-}
-
-LLVM_ATTRIBUTE_RETURNS_NONNULL inline void *calloc(size_t Count, size_t Sz) {
-  void *Result = std::calloc(Count, Sz);
-  if (Result == nullptr)
-    report_bad_alloc_error("Allocation failed.");
-  return Result;
-}
-
-LLVM_ATTRIBUTE_RETURNS_NONNULL inline void *realloc(void *Ptr, size_t Sz) {
-  void *Result = std::realloc(Ptr, Sz);
-  if (Result == nullptr)
-    report_bad_alloc_error("Allocation failed.");
-  return Result;
-}
-
-/// \}
-
 } // end namespace llvm
 
 template <typename AllocatorT, size_t SlabSize, size_t SizeThreshold>

Modified: llvm/trunk/include/llvm/Support/ErrorHandling.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorHandling.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ErrorHandling.h (original)
+++ llvm/trunk/include/llvm/Support/ErrorHandling.h Thu Feb 15 01:45:59 2018
@@ -100,8 +100,6 @@ void install_bad_alloc_error_handler(fat
 /// Restores default bad alloc error handling behavior.
 void remove_bad_alloc_error_handler();
 
-void install_out_of_memory_new_handler();
-
 /// Reports a bad alloc error, calling any user defined bad alloc
 /// error handler. In contrast to the generic 'report_fatal_error'
 /// functions, this function is expected to return, e.g. the user

Modified: llvm/trunk/include/llvm/Support/OnDiskHashTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/OnDiskHashTable.h?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/OnDiskHashTable.h (original)
+++ llvm/trunk/include/llvm/Support/OnDiskHashTable.h Thu Feb 15 01:45:59 2018
@@ -95,8 +95,7 @@ private:
 
   /// \brief Resize the hash table, moving the old entries into the new buckets.
   void resize(size_t NewSize) {
-    Bucket *NewBuckets = static_cast<Bucket *>(
-        llvm::calloc(NewSize, sizeof(Bucket)));
+    Bucket *NewBuckets = (Bucket *)std::calloc(NewSize, sizeof(Bucket));
     // Populate NewBuckets with the old entries.
     for (size_t I = 0; I < NumBuckets; ++I)
       for (Item *E = Buckets[I].Head; E;) {
@@ -227,7 +226,7 @@ public:
     NumBuckets = 64;
     // Note that we do not need to run the constructors of the individual
     // Bucket objects since 'calloc' returns bytes that are all 0.
-    Buckets = static_cast<Bucket *>(llvm::calloc(NumBuckets, sizeof(Bucket)));
+    Buckets = (Bucket *)std::calloc(NumBuckets, sizeof(Bucket));
   }
 
   ~OnDiskChainedHashTableGenerator() { std::free(Buckets); }

Modified: llvm/trunk/lib/CodeGen/InterferenceCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InterferenceCache.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/InterferenceCache.cpp (original)
+++ llvm/trunk/lib/CodeGen/InterferenceCache.cpp Thu Feb 15 01:45:59 2018
@@ -48,8 +48,8 @@ void InterferenceCache::reinitPhysRegEnt
   if (PhysRegEntriesCount == TRI->getNumRegs()) return;
   free(PhysRegEntries);
   PhysRegEntriesCount = TRI->getNumRegs();
-  PhysRegEntries = static_cast<unsigned char*>(
-      llvm::calloc(PhysRegEntriesCount, sizeof(unsigned char)));
+  PhysRegEntries = (unsigned char*)
+    calloc(PhysRegEntriesCount, sizeof(unsigned char));
 }
 
 void InterferenceCache::init(MachineFunction *mf,

Modified: llvm/trunk/lib/CodeGen/LiveIntervalUnion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalUnion.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalUnion.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalUnion.cpp Thu Feb 15 01:45:59 2018
@@ -187,7 +187,7 @@ void LiveIntervalUnion::Array::init(Live
   clear();
   Size = NSize;
   LIUs = static_cast<LiveIntervalUnion*>(
-      llvm::malloc(sizeof(LiveIntervalUnion)*NSize));
+    malloc(sizeof(LiveIntervalUnion)*NSize));
   for (unsigned i = 0; i != Size; ++i)
     new(LIUs + i) LiveIntervalUnion(Alloc);
 }

Modified: llvm/trunk/lib/CodeGen/RegisterPressure.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterPressure.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterPressure.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterPressure.cpp Thu Feb 15 01:45:59 2018
@@ -635,8 +635,7 @@ void PressureDiffs::init(unsigned N) {
   }
   Max = Size;
   free(PDiffArray);
-  PDiffArray = static_cast<PressureDiff*>(
-      llvm::calloc(N, sizeof(PressureDiff)));
+  PDiffArray = reinterpret_cast<PressureDiff*>(calloc(N, sizeof(PressureDiff)));
 }
 
 void PressureDiffs::addInstruction(unsigned Idx,

Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Thu Feb 15 01:45:59 2018
@@ -974,7 +974,7 @@ void Interpreter::visitAllocaInst(Alloca
   unsigned MemToAlloc = std::max(1U, NumElements * TypeSize);
 
   // Allocate enough memory to hold the type...
-  void *Memory = llvm::malloc(MemToAlloc);
+  void *Memory = malloc(MemToAlloc);
 
   DEBUG(dbgs() << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x " 
                << NumElements << " (Total: " << MemToAlloc << ") at "

Modified: llvm/trunk/lib/Object/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Object.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Object.cpp (original)
+++ llvm/trunk/lib/Object/Object.cpp Thu Feb 15 01:45:59 2018
@@ -228,7 +228,7 @@ uint64_t LLVMGetRelocationType(LLVMReloc
 const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI) {
   SmallVector<char, 0> ret;
   (*unwrap(RI))->getTypeName(ret);
-  char *str = static_cast<char*>(llvm::malloc(ret.size()));
+  char *str = static_cast<char*>(malloc(ret.size()));
   std::copy(ret.begin(), ret.end(), str);
   return str;
 }

Modified: llvm/trunk/lib/Support/ErrorHandling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ErrorHandling.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ErrorHandling.cpp (original)
+++ llvm/trunk/lib/Support/ErrorHandling.cpp Thu Feb 15 01:45:59 2018
@@ -175,39 +175,6 @@ void llvm::report_bad_alloc_error(const
 #endif
 }
 
-#ifdef LLVM_ENABLE_EXCEPTIONS
-// Do not set custom new handler if exceptions are enabled. In this case OOM
-// errors are handled by throwing 'std::bad_alloc'.
-void llvm::install_out_of_memory_new_handler() {
-}
-#else
-// Causes crash on allocation failure. It is called prior to the handler set by
-// 'install_bad_alloc_error_handler'.
-static void out_of_memory_new_handler() {
-  llvm::report_bad_alloc_error("Allocation failed");
-}
-
-// Installs new handler that causes crash on allocation failure. It does not
-// need to be called explicitly, if this file is linked to application, because
-// in this case it is called during construction of 'new_handler_installer'.
-void llvm::install_out_of_memory_new_handler() {
-  static bool out_of_memory_new_handler_installed = false;
-  if (!out_of_memory_new_handler_installed) {
-    std::set_new_handler(out_of_memory_new_handler);
-    out_of_memory_new_handler_installed = true;
-  }
-}
-
-// Static object that causes installation of 'out_of_memory_new_handler' before
-// execution of 'main'.
-static class NewHandlerInstaller {
-public:
-  NewHandlerInstaller() {
-    install_out_of_memory_new_handler();
-  }
-} new_handler_installer;
-#endif
-
 void llvm::llvm_unreachable_internal(const char *msg, const char *file,
                                      unsigned line) {
   // This code intentionally doesn't call the ErrorHandler callback, because

Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Thu Feb 15 01:45:59 2018
@@ -214,8 +214,7 @@ static void **GetBucketFor(unsigned Hash
 
 /// AllocateBuckets - Allocated initialized bucket memory.
 static void **AllocateBuckets(unsigned NumBuckets) {
-  void **Buckets = static_cast<void**>(
-      llvm::calloc(NumBuckets+1, sizeof(void*)));
+  void **Buckets = static_cast<void**>(calloc(NumBuckets+1, sizeof(void*)));
 
   if (Buckets == nullptr)
     report_bad_alloc_error("Allocation of Buckets failed.");

Modified: llvm/trunk/lib/Support/RWMutex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/RWMutex.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/RWMutex.cpp (original)
+++ llvm/trunk/lib/Support/RWMutex.cpp Thu Feb 15 01:45:59 2018
@@ -11,7 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/Allocator.h"
 #include "llvm/Support/RWMutex.h"
 #include "llvm/Config/config.h"
 
@@ -50,7 +49,7 @@ RWMutexImpl::RWMutexImpl()
 {
   // Declare the pthread_rwlock data structures
   pthread_rwlock_t* rwlock =
-    static_cast<pthread_rwlock_t*>(llvm::malloc(sizeof(pthread_rwlock_t)));
+    static_cast<pthread_rwlock_t*>(malloc(sizeof(pthread_rwlock_t)));
 
 #ifdef __APPLE__
   // Workaround a bug/mis-feature in Darwin's pthread_rwlock_init.

Modified: llvm/trunk/lib/Support/StringMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringMap.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/StringMap.cpp (original)
+++ llvm/trunk/lib/Support/StringMap.cpp Thu Feb 15 01:45:59 2018
@@ -57,9 +57,10 @@ void StringMapImpl::init(unsigned InitSi
   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(unsi
   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.");
 

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Thu Feb 15 01:45:59 2018
@@ -138,7 +138,7 @@ static void CreateSigAltStack() {
     return;
 
   stack_t AltStack = {};
-  AltStack.ss_sp = static_cast<char *>(llvm::malloc(AltStackSize));
+  AltStack.ss_sp = reinterpret_cast<char *>(malloc(AltStackSize));
   NewAltStackPointer = AltStack.ss_sp; // Save to avoid reporting a leak.
   AltStack.ss_size = AltStackSize;
   if (sigaltstack(&AltStack, &OldAltStack) != 0)

Modified: llvm/trunk/lib/Support/Windows/RWMutex.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/RWMutex.inc?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/RWMutex.inc (original)
+++ llvm/trunk/lib/Support/Windows/RWMutex.inc Thu Feb 15 01:45:59 2018
@@ -74,10 +74,10 @@ static bool loadSRW() {
 
 sys::RWMutexImpl::RWMutexImpl() {
   if (loadSRW()) {
-    data_ = llvm::calloc(1, sizeof(SRWLOCK));
+    data_ = calloc(1, sizeof(SRWLOCK));
     fpInitializeSRWLock(static_cast<PSRWLOCK>(data_));
   } else {
-    data_ = llvm::calloc(1, sizeof(CRITICAL_SECTION));
+    data_ = calloc(1, sizeof(CRITICAL_SECTION));
     InitializeCriticalSection(static_cast<LPCRITICAL_SECTION>(data_));
   }
 }

Modified: llvm/trunk/tools/llvm-c-test/attributes.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/attributes.c?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/attributes.c (original)
+++ llvm/trunk/tools/llvm-c-test/attributes.c Thu Feb 15 01:45:59 2018
@@ -14,7 +14,6 @@
 
 #include "llvm-c-test.h"
 
-#include <assert.h>
 #include <stdlib.h>
 
 int llvm_test_function_attributes(void) {
@@ -31,7 +30,6 @@ int llvm_test_function_attributes(void)
       int AttrCount = LLVMGetAttributeCountAtIndex(F, Idx);
       LLVMAttributeRef *Attrs =
           (LLVMAttributeRef *)malloc(AttrCount * sizeof(LLVMAttributeRef));
-      assert(Attrs);
       LLVMGetAttributesAtIndex(F, Idx, Attrs);
       free(Attrs);
     }
@@ -63,7 +61,6 @@ int llvm_test_callsite_attributes(void)
             int AttrCount = LLVMGetCallSiteAttributeCount(I, Idx);
             LLVMAttributeRef *Attrs = (LLVMAttributeRef *)malloc(
                 AttrCount * sizeof(LLVMAttributeRef));
-            assert(Attrs);
             LLVMGetCallSiteAttributes(I, Idx, Attrs);
             free(Attrs);
           }

Modified: llvm/trunk/tools/llvm-c-test/echo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/echo.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/echo.cpp (original)
+++ llvm/trunk/tools/llvm-c-test/echo.cpp Thu Feb 15 01:45:59 2018
@@ -90,8 +90,7 @@ struct TypeCloner {
         unsigned ParamCount = LLVMCountParamTypes(Src);
         LLVMTypeRef* Params = nullptr;
         if (ParamCount > 0) {
-          Params = static_cast<LLVMTypeRef*>(
-              llvm::malloc(ParamCount * sizeof(LLVMTypeRef)));
+          Params = (LLVMTypeRef*) malloc(ParamCount * sizeof(LLVMTypeRef));
           LLVMGetParamTypes(Src, Params);
           for (unsigned i = 0; i < ParamCount; i++)
             Params[i] = Clone(Params[i]);

Modified: llvm/trunk/unittests/Support/AllocatorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/AllocatorTest.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/AllocatorTest.cpp (original)
+++ llvm/trunk/unittests/Support/AllocatorTest.cpp Thu Feb 15 01:45:59 2018
@@ -147,7 +147,7 @@ public:
     // Allocate space for the alignment, the slab, and a void* that goes right
     // before the slab.
     size_t Alignment = 4096;
-    void *MemBase = llvm::malloc(Size + Alignment - 1 + sizeof(void*));
+    void *MemBase = malloc(Size + Alignment - 1 + sizeof(void*));
 
     // Find the slab start.
     void *Slab = (void *)alignAddr((char*)MemBase + sizeof(void *), Alignment);

Modified: llvm/trunk/unittests/Support/ManagedStatic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ManagedStatic.cpp?rev=325227&r1=325226&r2=325227&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ManagedStatic.cpp (original)
+++ llvm/trunk/unittests/Support/ManagedStatic.cpp Thu Feb 15 01:45:59 2018
@@ -6,8 +6,6 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Allocator.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Config/config.h"
 #ifdef HAVE_PTHREAD_H
@@ -32,7 +30,7 @@ namespace test1 {
   // Valgrind's leak checker complains glibc's stack allocation.
   // To appease valgrind, we provide our own stack for each thread.
   void *allocate_stack(pthread_attr_t &a, size_t n = 65536) {
-    void *stack = llvm::malloc(n);
+    void *stack = malloc(n);
     pthread_attr_init(&a);
 #if defined(__linux__)
     pthread_attr_setstack(&a, stack, n);
@@ -85,7 +83,7 @@ TEST(ManagedStaticTest, NestedStatics) {
 namespace CustomCreatorDeletor {
 struct CustomCreate {
   static void *call() {
-    void *Mem = llvm::malloc(sizeof(int));
+    void *Mem = std::malloc(sizeof(int));
     *((int *)Mem) = 42;
     return Mem;
   }




More information about the llvm-commits mailing list