aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenObjC/encode-test.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenObjC/encode-test.m')
-rw-r--r--test/CodeGenObjC/encode-test.m61
1 files changed, 55 insertions, 6 deletions
diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m
index 9d1cf6cec3c4..24a90a0b4b99 100644
--- a/test/CodeGenObjC/encode-test.m
+++ b/test/CodeGenObjC/encode-test.m
@@ -1,10 +1,7 @@
// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep -e "\^{Innermost=CC}" %t | count 1
-// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1
-// RUN: grep -e "{B1=#@c}" %t | count 1
-// RUN: grep -e "v12@0:4\[3\[4@]]8" %t | count 1
-// RUN: grep -e "r\^{S=i}" %t | count 1
-// RUN: grep -e "\^{Object=#}" %t | count 1
+// RUN: FileCheck < %t %s
+//
+// CHECK: @"\01L_OBJC_METH_VAR_TYPE_34" = internal global [16 x i8] c"v12@0:4[3[4@]]8\00"
@class Int1;
@@ -95,3 +92,55 @@ int main()
const char *ee = @encode(MyObj *const);
}
+// CHECK: @g0 = constant [15 x i8] c"{Innermost=CC}\00"
+const char g0[] = @encode(struct Innermost);
+
+// CHECK: @g1 = constant [38 x i8] c"{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}\00"
+const char g1[] = @encode(Derived);
+
+// CHECK: @g2 = constant [9 x i8] c"{B1=#@c}\00"
+const char g2[] = @encode(B1);
+
+// CHECK: @g3 = constant [8 x i8] c"r^{S=i}\00"
+const char g3[] = @encode(const struct S *);
+
+// CHECK: @g4 = constant [6 x i8] c"{S=i}\00"
+const char g4[] = @encode(const struct S);
+
+// CHECK: @g5 = constant [12 x i8] c"^{Object=#}\00"
+const char g5[] = @encode(MyObj * const);
+
+////
+
+enum Enum1X { one, two, three, four };
+
+@interface Base1X {
+ unsigned a: 2;
+ int b: 3;
+ enum Enum1X c: 4;
+ unsigned d: 5;
+}
+@end
+
+@interface Derived1X: Base1X {
+ signed e: 5;
+ int f: 4;
+ enum Enum1X g: 3;
+}
+@end
+
+@implementation Base1X @end
+
+@implementation Derived1X @end
+
+// CHECK: @g6 = constant [18 x i8] c"{Base1X=b2b3b4b5}\00"
+const char g6[] = @encode(Base1X);
+
+// CHECK: @g7 = constant [27 x i8] c"{Derived1X=b2b3b4b5b5b4b3}\00"
+const char g7[] = @encode(Derived1X);
+
+// CHECK: @g8 = constant [7 x i8] c"{s8=D}\00"
+struct s8 {
+ long double x;
+};
+const char g8[] = @encode(struct s8);