[llvm] r328334 - [ADT] Simplify getMemory. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 23 10:26:12 PDT 2018
Author: maskray
Date: Fri Mar 23 10:26:12 2018
New Revision: 328334
URL: http://llvm.org/viewvc/llvm-project?rev=328334&view=rev
Log:
[ADT] Simplify getMemory. NFC
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=328334&r1=328333&r2=328334&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Fri Mar 23 10:26:12 2018
@@ -33,8 +33,7 @@ using namespace llvm;
/// A utility function for allocating memory, checking for allocation failures,
/// and ensuring the contents are zeroed.
inline static uint64_t* getClearedMemory(unsigned numWords) {
- uint64_t * result = new uint64_t[numWords];
- assert(result && "APInt memory allocation fails!");
+ uint64_t *result = new uint64_t[numWords];
memset(result, 0, numWords * sizeof(uint64_t));
return result;
}
@@ -42,9 +41,7 @@ inline static uint64_t* getClearedMemory
/// A utility function for allocating memory and checking for allocation
/// failure. The content is not zeroed.
inline static uint64_t* getMemory(unsigned numWords) {
- uint64_t * result = new uint64_t[numWords];
- assert(result && "APInt memory allocation fails!");
- return result;
+ return new uint64_t[numWords];
}
/// A utility function that converts a character to a digit.
More information about the llvm-commits
mailing list