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

Zhongxing Xu xuzhongxing at gmail.com
Mon Nov 9 19:27:00 PST 2009


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. "





More information about the cfe-commits mailing list