[PATCH] Make sure CallExpr::getLocStart doesn't segfault

Keno Fischer kfischer at college.harvard.edu
Thu Aug 14 18:40:57 PDT 2014


================
Comment at: lib/AST/Expr.cpp:1255
@@ -1254,3 +1254,3 @@
   SourceLocation begin = getCallee()->getLocStart();
-  if (begin.isInvalid() && getNumArgs() > 0)
+  if (begin.isInvalid() && getNumArgs() > 0 && getArg(0) != nullptr)
     begin = getArg(0)->getLocStart();
----------------
Reid Kleckner wrote:
> Clang and LLVM typically rely on implicit truth for null tests, so "&& getArg(0)" is probably enough.
Ok, will change and commit.

http://reviews.llvm.org/D4917






More information about the cfe-commits mailing list