From: Zhongxing Xu Date: Tue, 10 Nov 2009 03:27:00 +0000 (+0000) Subject: Use the source range of the whole sizeof expression, otherwise it crashes when X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=572ea2697dc6fe972580779f1f69e5a987f206c9;p=clang Use the source range of the whole sizeof expression, otherwise it crashes when the argument is not an expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86660 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/CheckSizeofPointer.cpp b/lib/Analysis/CheckSizeofPointer.cpp index 02393111e3..80a2a18c08 100644 --- a/lib/Analysis/CheckSizeofPointer.cpp +++ b/lib/Analysis/CheckSizeofPointer.cpp @@ -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. "