[llvm-dev] PVS-Studio analysis of LLVM code
Jonas Wagner via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 2 06:41:34 PDT 2016
Hello,
I think this should be added by Clang itself.
I don't think so. There are several sources online that indicate that
developers need to *manually* specify std::nothrow. If they don't, operator
new will throw an exception even if code is compiled with -fno-exception.
This will abort the program.
At some point, this caused Firefox to replace a bunch of `new` with
`new(std::nothrow)` [1] Would this be a good idea in LLVM as well? Or
should we just let LLVM crash on OOM, and remove the null-checks as PVS
suggests?
Or we need to use STL compiled with -fno-exceptions (libstdc++ or libc++).
>
Well, in this case PVS would have reported a false positive. Would it be
possible to adjust PVS's V668 <http://www.viva64.com/en/w/V668/>, so that
it could detect whether std::nothrow is needed or not?
Best,
Jonas
[1]
https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161102/05cf5228/attachment.html>
More information about the llvm-dev
mailing list