From cdac761475699c097731d4bc045eade6c5f8b536 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 25 Feb 2014 12:26:20 +0000 Subject: 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 --- clang/lib/AST/Expr.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/AST/Expr.cpp') 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)+ -- cgit v1.2.3