[cfe-commits] r86660 - /cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp

Ted Kremenek kremenek at apple.com
Mon Nov 9 20:16:48 PST 2009


I think we should now have the size of the type expression as well,  
but highlighting the entire sizeof is fine.

On Nov 9, 2009, at 7:27 PM, Zhongxing Xu wrote:

> Author: zhongxingxu
> Date: Mon Nov  9 21:27:00 2009
> New Revision: 86660
>
> URL: http://llvm.org/viewvc/llvm-project?rev=86660&view=rev
> Log:
> Use the source range of the whole sizeof expression, otherwise it  
> crashes when
> the argument is not an expression.
>
> Modified:
>    cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp
>
> Modified: cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp?rev=86660&r1=86659&r2=86660&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp (original)
> +++ cfe/trunk/lib/Analysis/CheckSizeofPointer.cpp Mon Nov  9  
> 21:27:00 2009
> @@ -44,7 +44,7 @@
>
>   QualType T = E->getTypeOfArgument();
>   if (T->isPointerType()) {
> -    SourceRange R = E->getArgumentExpr()->getSourceRange();
> +    SourceRange R = E->getSourceRange();
>     BR.EmitBasicReport("Potential unintended use of sizeof() on  
> pointer type",
>                        "Logic",
>                        "The code calls sizeof() on a pointer type. "
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list