r269572 - Warn when a reference is bound to an empty l-value (dereferenced null pointer).
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Mon May 16 09:54:09 PDT 2016
On Sat, May 14, 2016 at 10:44 AM, Nick Lewycky via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: nicholas
> Date: Sat May 14 12:44:14 2016
> New Revision: 269572
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269572&view=rev
> Log:
> Warn when a reference is bound to an empty l-value (dereferenced null pointer).
Could this be made to handle return values too? The warning fired on
some code in pdfium, and nearby I found this:
TYPE& ElementAt(int nIndex) {
if (nIndex < 0 || nIndex >= m_nSize) {
return *(TYPE*)NULL; <-- Ooops
}
return ((TYPE*)m_pData)[nIndex];
}
where the warning doesn't fire.
More information about the cfe-commits
mailing list