AST/SILGen support for constant string literals

rdar://30545013
This commit is contained in:
Arnold Schwaighofer
2017-04-11 09:34:23 -07:00
parent ea48ab5060
commit 4d60ec333b
10 changed files with 121 additions and 10 deletions

View File

@@ -157,7 +157,7 @@ class alignas(8) Expr {
friend class StringLiteralExpr;
unsigned : NumLiteralExprBits;
unsigned Encoding : 2;
unsigned Encoding : 3;
unsigned IsSingleUnicodeScalar : 1;
unsigned IsSingleExtendedGraphemeCluster : 1;
};
@@ -940,6 +940,12 @@ public:
/// A UTF-16 string.
UTF16,
/// A UTF-8 constant string.
UTF8ConstString,
/// A UTF-16 constant string.
UTF16ConstString,
/// A single UnicodeScalar, passed as an integer.
OneUnicodeScalar
};

View File

@@ -123,6 +123,8 @@ IDENTIFIER(unicodeScalarLiteral)
IDENTIFIER(stringLiteral)
IDENTIFIER_(builtinUTF16StringLiteral)
IDENTIFIER_(builtinStringLiteral)
IDENTIFIER_(builtinConstUTF16StringLiteral)
IDENTIFIER_(builtinConstStringLiteral)
IDENTIFIER(StringLiteralType)
IDENTIFIER(stringInterpolation)
IDENTIFIER(stringInterpolationSegment)

View File

@@ -87,6 +87,8 @@ BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinIntegerLiteral)
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinStringLiteral)
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinUTF16StringLiteral)
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinUnicodeScalarLiteral)
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinConstStringLiteral)
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinConstUTF16StringLiteral)
#undef EXPRESSIBLE_BY_LITERAL_PROTOCOL
#undef EXPRESSIBLE_BY_LITERAL_PROTOCOL_

View File

@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 332; // Last change: constant_string_literal
const uint16_t VERSION_MINOR = 333; // Last change: AST constant_string_literal
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;