diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-08-20 20:55:45 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-08-20 20:55:45 +0000 |
commit | f0a26499c0ef62c7940b596be092315922a46ab7 (patch) | |
tree | 75d5ccc2fd953713a9262550f9536ec197e6b28a /lib/AST/Expr.cpp | |
parent | 1da79335fcb5e42010ace09a38d0ecbf3657b9d2 (diff) |
Fix InitListExpr::isStringLiteralInit so it handles various edge cases correctly. PR13643.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 24361efafa..7e82382942 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1723,10 +1723,10 @@ void InitListExpr::setArrayFiller(Expr *filler) { bool InitListExpr::isStringLiteralInit() const { if (getNumInits() != 1) return false; - const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(getType()); - if (!CAT || !CAT->getElementType()->isIntegerType()) + const ArrayType *AT = getType()->getAsArrayTypeUnsafe(); + if (!AT || !AT->getElementType()->isIntegerType()) return false; - const Expr *Init = getInit(0)->IgnoreParenImpCasts(); + const Expr *Init = getInit(0)->IgnoreParens(); return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init); } |