blob: 24c2b9450780d11a1f76ef0233f73ec1267cba1b [file] [log] [blame]
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
// REQUIRES: CPU=x86_64
// CHECK: [[U8_0:@.*]] = private unnamed_addr constant [8 x i8] c"help\09me\00"
// CHECK: [[U8_1:@.*]] = private unnamed_addr constant [5 x i8] c"\00x\C6\AB\00"
sil_stage canonical
import Builtin
sil @utf8_literal : $@convention(thin) () -> Builtin.RawPointer {
bb0:
%0 = string_literal utf8 "help\tme"
return %0 : $Builtin.RawPointer
}
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc i8* @utf8_literal() {{.*}} {
// CHECK: ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* [[U8_0]], i64 0, i64 0)
sil @utf8_literal_with_nul : $@convention(thin) () -> Builtin.RawPointer {
bb0:
%0 = string_literal utf8 "\u{00}x\u{01ab}"
return %0 : $Builtin.RawPointer
}
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc i8* @utf8_literal_with_nul() {{.*}} {
// CHECK: ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[U8_1]], i64 0, i64 0)