diff options
author | dim <dim@FreeBSD.org> | 2015-02-25 17:54:18 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-02-25 17:54:18 +0000 |
commit | a98c93ae725cddb4e66eb395835b27bc9f2587e5 (patch) | |
tree | 49065ad12696a9ebdefc9a58e10cba0e206c8b52 /contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff | |
parent | 3ebe79edba7c5e44da137fd957e61f314da5ded7 (diff) | |
download | FreeBSD-src-a98c93ae725cddb4e66eb395835b27bc9f2587e5.zip FreeBSD-src-a98c93ae725cddb4e66eb395835b27bc9f2587e5.tar.gz |
Add clang patches corresponding to r279289.
Diffstat (limited to 'contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff')
-rw-r--r-- | contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff b/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff new file mode 100644 index 0000000..b2079df --- /dev/null +++ b/contrib/llvm/patches/patch-r279289-clang-r199571-fix-string-literal-assertion.diff @@ -0,0 +1,31 @@ +Pull in r199571 from upstream clang trunk (by Ted Kremenek): + + Harden InitListExpr::isStringLiteralInit() against getInit() + returning null. + + This led to a crash on invalid code (sorry, no good test case). + + Fixes <rdar://problem/15831804>. + +This fixes an assertion when compiling certain incorrect code, as +reported upstream in http://llvm.org/PR22684 . + +Introduced here: http://svnweb.freebsd.org/changeset/base/279289 + +Index: tools/clang/lib/AST/Expr.cpp +=================================================================== +--- tools/clang/lib/AST/Expr.cpp ++++ tools/clang/lib/AST/Expr.cpp +@@ -1892,7 +1892,11 @@ bool InitListExpr::isStringLiteralInit() const { + const ArrayType *AT = getType()->getAsArrayTypeUnsafe(); + if (!AT || !AT->getElementType()->isIntegerType()) + return false; +- const Expr *Init = getInit(0)->IgnoreParens(); ++ // It is possible for getInit() to return null. ++ const Expr *Init = getInit(0); ++ if (!Init) ++ return false; ++ Init = Init->IgnoreParens(); + return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init); + } + |