summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-02-25 12:26:20 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-02-25 12:26:20 +0000
commitcdac761475699c097731d4bc045eade6c5f8b536 (patch)
treea8e198c82235ef08560314c66295a692981663f1 /clang/lib/AST/Expr.cpp
parentfc188424376671277266f2c4fb5e37498b512bfb (diff)
downloadbcm5719-llvm-cdac761475699c097731d4bc045eade6c5f8b536.tar.gz
bcm5719-llvm-cdac761475699c097731d4bc045eade6c5f8b536.zip
Sema: When merging objc string literals, give the result a constant array type.
Also assert that we never create non-array string literals again. PR18939. llvm-svn: 202147
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 3f5833c5015..4492d02b7a7 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -781,6 +781,9 @@ StringLiteral *StringLiteral::Create(const ASTContext &C, StringRef Str,
StringKind Kind, bool Pascal, QualType Ty,
const SourceLocation *Loc,
unsigned NumStrs) {
+ assert(C.getAsConstantArrayType(Ty) &&
+ "StringLiteral must be of constant array type!");
+
// Allocate enough space for the StringLiteral plus an array of locations for
// any concatenated string tokens.
void *Mem = C.Allocate(sizeof(StringLiteral)+
OpenPOWER on IntegriCloud