]> granicus.if.org Git - llvm/commit
[ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Tue, 9 Jun 2015 09:47:46 +0000 (09:47 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Tue, 9 Jun 2015 09:47:46 +0000 (09:47 +0000)
commit07ce69ae7d218d526d69ffc3245ec94529b7aa1d
tree09456a55e9032ed0d4f805e72770c6fdcade06b8
parent6f9520411c65afb55612dfc2bf9827657963eed5
[ADT] Assert that SmallVectorBase::grow_pod() successfully reallocates memory.

Summary:
If malloc/realloc fails then the SmallVector becomes unusable since begin() and
end() will return NULL. This is unlikely to occur but was the cause of recent
bugpoint test failures on my machine.

It is not clear whether not checking for malloc/realloc failure is a deliberate
decision and adding checks has the potential to impact compiler performance.
Therefore, this patch only adds the check to builds with assertions enabled for
the moment.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: bkramer, llvm-commits

Differential Revision: http://reviews.llvm.org/D9520

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239392 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/SmallVector.cpp