summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/ms-annotation.c26
-rw-r--r--clang/test/Sema/ms-annotation.c13
2 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ms-annotation.c b/clang/test/CodeGen/ms-annotation.c
new file mode 100644
index 00000000000..4459fc032a0
--- /dev/null
+++ b/clang/test/CodeGen/ms-annotation.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -triple i686-windows %s -fms-extensions -emit-llvm -o - | FileCheck %s
+//
+// Test that LLVM optimizations leave these intrinsics alone, for the most part.
+// RUN: %clang_cc1 -O2 -triple i686-windows %s -fms-extensions -emit-llvm -o - | FileCheck %s
+
+void test1(void) {
+ __annotation(L"a1");
+ __annotation(L"a1", L"a2");
+ __annotation(L"a1", L"a2", L"a3");
+ __annotation(L"multi " L"part " L"string");
+ __annotation(L"unicode: \u0ca0_\u0ca0");
+}
+
+// CHECK-LABEL: define void @test1()
+// CHECK: call void @llvm.label.annotation(metadata ![[A1:[0-9]+]])
+// CHECK: call void @llvm.label.annotation(metadata ![[A2:[0-9]+]])
+// CHECK: call void @llvm.label.annotation(metadata ![[A3:[0-9]+]])
+// CHECK: call void @llvm.label.annotation(metadata ![[A4:[0-9]+]])
+// CHECK: call void @llvm.label.annotation(metadata ![[A5:[0-9]+]])
+// CHECK: ret void
+
+// CHECK: ![[A1]] = !{!"a1"}
+// CHECK: ![[A2]] = !{!"a1", !"a2"}
+// CHECK: ![[A3]] = !{!"a1", !"a2", !"a3"}
+// CHECK: ![[A4]] = !{!"multi part string"}
+// CHECK: ![[A5]] = !{!"unicode: \E0\B2\A0_\E0\B2\A0"}
diff --git a/clang/test/Sema/ms-annotation.c b/clang/test/Sema/ms-annotation.c
new file mode 100644
index 00000000000..9a2beebf065
--- /dev/null
+++ b/clang/test/Sema/ms-annotation.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple i686-windows %s -verify -fms-extensions
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple i686-windows %s -verify -fms-extensions
+// RUN: %clang_cc1 -x c++ -std=c++14 -triple i686-windows %s -verify -fms-extensions
+
+void test1(void) {
+ __annotation(); // expected-error {{too few arguments to function call, expected at least 1, have 0}}
+ __annotation(1); // expected-error {{must be wide string constants}}
+ __annotation(L"a1");
+ __annotation(L"a1", L"a2");
+ __annotation(L"a1", L"a2", 42); // expected-error {{must be wide string constants}}
+ __annotation(L"a1", L"a2", L"a3");
+ __annotation(L"multi " L"part " L"string");
+}
OpenPOWER on IntegriCloud