History log of /external/clang/test/Analysis/new-with-exceptions.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f18bfd44c4fe4ab28c44eecb7aeed618bcf8f627 28-Aug-2013 Pavel Labath <labath@google.com> [analyzer] Assume new returns non-null even under -fno-exceptions

Summary:
-fno-exceptions does not implicitly attach a nothrow specifier to every operator
new. Even in this mode, non-nothrow new must not return a null pointer. Failure
to allocate memory can be signalled by other means, or just by killing the
program. This behaviour is consistent with the compiler - even with
-fno-exceptions, the generated code never tests for null (and would segfault if
the opeator actually happened to return null).

Reviewers: jordan_rose

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1528

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Analysis/new-with-exceptions.cpp
b59b580a57a36df9d146473098d14c64508ff319 20-Oct-2012 Jordan Rose <jordan_rose@apple.com> [analyzer] Assume 'new' never returns NULL if it could throw an exception.

This is actually required by the C++ standard in
[basic.stc.dynamic.allocation]p3:

If an allocation function declared with a non-throwing
exception-specification fails to allocate storage, it shall return a
null pointer. Any other allocation function that fails to allocate
storage shall indicate failure only by throwing an exception of a type
that would match a handler of type std::bad_alloc.

We don't bother checking for the specific exception type, but just go off
the operator new prototype. This should help with a certain class of lazy
initalization false positives.

<rdar://problem/12115221>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/Analysis/new-with-exceptions.cpp