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 0239311..80a2a18 100644
--- a/lib/Analysis/CheckSizeofPointer.cpp
+++ b/lib/Analysis/CheckSizeofPointer.cpp
@@ -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. "