[cfe-commits] r92318 - /cfe/trunk/lib/AST/ASTContext.cpp

Chris Lattner clattner at apple.com
Tue Jan 5 10:07:24 PST 2010


On Jan 5, 2010, at 1:27 AM, Zhongxing Xu wrote:

> I reverted this patch, and fix the analyzer in r92723.

Thanks!

-Chris

>
> 2010/1/5 Zhongxing Xu <xuzhongxing at gmail.com>
>
>
> 2010/1/5 Chris Lattner <clattner at apple.com>
>
> On Jan 4, 2010, at 10:53 PM, Chandler Carruth wrote:
>
> >>
> >> Sorry, I didn't quite understand your point. We are already  
> asserting the
> >> QualType T is canonical on the entry to the method.
> >>
> >> The patch makes sure the element type is canonical when we pass  
> it to the
> >> method getUnqualifiedArrayType().
> >
> > I think what Chris is getting at is that the element type should
> > already be canonical if the array type is canonical (by my reading  
> of
> > getCanonicalType)?
>
> Right, if an arraytype is canonical, then its element is guaranteed  
> to be canonical.
>
> -Chris
>
> I see. I added the assertion.
> This code still crashes clang:
>
> $ clang -cc1 -analyze -checker-cfref crash.c
>
>  #include <string.h>
> typedef unsigned char Byte;
> void doit (char *data, int len) {
>     if (len) {
>         Byte buf[len];
>         memcpy(buf, data, len);
>     }
> }
>
>
> The problem is that the canonical type of type 'Byte' is itself.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100105/1f30f339/attachment.html>


More information about the cfe-commits mailing list