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

Reid Kleckner rnk at google.com
Thu Aug 14 16:49:42 PDT 2014


lgtm

================
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();
----------------
Clang and LLVM typically rely on implicit truth for null tests, so "&& getArg(0)" is probably enough.

http://reviews.llvm.org/D4917






More information about the cfe-commits mailing list