On Sat, May 14, 2016 at 10:44 AM, Nick Lewycky via cfe-commits
<cfe-commits@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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to