]> granicus.if.org Git - clang/commitdiff
Use the source range of the whole sizeof expression, otherwise it crashes when
authorZhongxing Xu <xuzhongxing@gmail.com>
Tue, 10 Nov 2009 03:27:00 +0000 (03:27 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Tue, 10 Nov 2009 03:27:00 +0000 (03:27 +0000)
the argument is not an expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86660 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CheckSizeofPointer.cpp

index 02393111e3cbab52254cc22c78d5d6ab3abc2c29..80a2a18c083654f8ce1285cdcf063003286b0373 100644 (file)
@@ -44,7 +44,7 @@ void WalkAST::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
 
   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. "