blob: df821968917aac23174ce4d63503f01449e7894c [file] [log] [blame]
Saleem Abdulrasool2460a36f2016-05-30 16:36:48 +00001// REQUIRES: x86-registered-target
2
3// RUN: %clang_cc1 -triple x86_64-macho -emit-llvm -o %t %s
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +00004// RUN: FileCheck --check-prefix=CHECK-NEXT < %t %s
Daniel Dunbarc01f56c2008-09-04 04:36:23 +00005
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +00006// Check that we set alignment 1 on the string.
7//
Rafael Espindolad19f80a2014-01-20 20:33:18 +00008// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", section "__TEXT,__cstring,cstring_literals", align 1
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +00009
Saleem Abdulrasool2460a36f2016-05-30 16:36:48 +000010// RUN: %clang_cc1 -triple x86_64-macho -fobjc-runtime=gcc -emit-llvm -o %t %s
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +000011// RUN: FileCheck --check-prefix=CHECK-GNU < %t %s
12// CHECK-GNU: NXConstantString
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +000013
Saleem Abdulrasool2460a36f2016-05-30 16:36:48 +000014// RUN: %clang_cc1 -triple x86_64-macho -fobjc-runtime=gcc -fconstant-string-class NSConstantString -emit-llvm -o %t %s
Daniel Dunbar9c8cd4c2011-04-12 23:30:52 +000015// RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s
16// CHECK-GNU-WITH-CLASS: NSConstantString
David Chisnall404bbcb2018-05-22 10:13:06 +000017//
18// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -fobjc-runtime=gnustep-2.0 -emit-llvm -o %t %s
19// RUN: FileCheck --check-prefix=CHECK-GNUSTEP2 < %t %s
Bjorn Pettersson84466332018-05-22 08:16:45 +000020
David Chisnall404bbcb2018-05-22 10:13:06 +000021// CHECK-GNUSTEP2: @._OBJC_CLASS_NSConstantString = external global i8*
22// CHECK-GNUSTEP2: @0 = private unnamed_addr constant [13 x i8] c"Hello World!\00", align 1
23// CHECK-GNUSTEP2: @.objc_string = private global { i8**, i32, i32, i32, i32, i8* } { i8** @._OBJC_CLASS_NSConstantString, i32 0, i32 12, i32 12, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @0, i64 0, i64 0) }, section "__objc_constant_string", align 8
24// CHECK-GNUSTEP2: @b = global i8* inttoptr (i64 -3340545023602065388 to i8*), align 8
25// CHECK-GNUSTEP2: @.objc_str_Hello_World = linkonce_odr hidden global { i8**, i32, i32, i32, i32, i8* } { i8** @._OBJC_CLASS_NSConstantString, i32 0, i32 11, i32 11, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @1, i64 0, i64 0) }, section "__objc_constant_string", comdat, align 8
26// CHECK-GNUSTEP2: @c =
27// CHECK-SAME-GNUSTEP2: @.objc_str_Hello_World
28//
29id a = @"Hello World!";
30id b = @"hi";
31id c = @"Hello World";