1Pull in r199571 from upstream clang trunk (by Ted Kremenek):
2
3  Harden InitListExpr::isStringLiteralInit() against getInit()
4  returning null.
5
6  This led to a crash on invalid code (sorry, no good test case).
7
8  Fixes <rdar://problem/15831804>.
9
10This fixes an assertion when compiling certain incorrect code, as
11reported upstream in http://llvm.org/PR22684 .
12
13Introduced here: http://svnweb.freebsd.org/changeset/base/279289
14
15Index: tools/clang/lib/AST/Expr.cpp
16===================================================================
17--- tools/clang/lib/AST/Expr.cpp
18+++ tools/clang/lib/AST/Expr.cpp
19@@ -1892,7 +1892,11 @@ bool InitListExpr::isStringLiteralInit() const {
20   const ArrayType *AT = getType()->getAsArrayTypeUnsafe();
21   if (!AT || !AT->getElementType()->isIntegerType())
22     return false;
23-  const Expr *Init = getInit(0)->IgnoreParens();
24+  // It is possible for getInit() to return null.
25+  const Expr *Init = getInit(0);
26+  if (!Init)
27+    return false;
28+  Init = Init->IgnoreParens();
29   return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init);
30 }
31 
32