diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-14 01:52:20 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-02-14 01:52:20 +0000 |
| commit | 902a0238aa1514832a0d88661c9d7ccf112b71e0 (patch) | |
| tree | b8f1416976d83e831505038bf401ff6881b1dcf2 /clang/lib/CodeGen | |
| parent | ce27e42d47bbc136cf1deb1859e10e9e8da5b501 (diff) | |
| download | bcm5719-llvm-902a0238aa1514832a0d88661c9d7ccf112b71e0.tar.gz bcm5719-llvm-902a0238aa1514832a0d88661c9d7ccf112b71e0.zip | |
DR1748: the reserved placement allocation functions have undefined behavior if
they're given a null pointer as an argument, so we do not need to emit null
checks on their results.
llvm-svn: 229213
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index cead8a429df..6852d3afc7f 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1279,10 +1279,9 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { // Emit a null check on the allocation result if the allocation // function is allowed to return null (because it has a non-throwing - // exception spec; for this part, we inline - // CXXNewExpr::shouldNullCheckAllocation()) and we have an + // exception spec or is the reserved placement new) and we have an // interesting initializer. - bool nullCheck = allocatorType->isNothrow(getContext()) && + bool nullCheck = E->shouldNullCheckAllocation(getContext()) && (!allocType.isPODType(getContext()) || E->hasInitializer()); llvm::BasicBlock *nullCheckBB = nullptr; |

