summaryrefslogtreecommitdiffstats
path: root/test/Lexer
diff options
context:
space:
mode:
Diffstat (limited to 'test/Lexer')
-rw-r--r--test/Lexer/block_cmt_end.c8
-rw-r--r--test/Lexer/has_extension.c30
-rw-r--r--test/Lexer/has_extension_cxx.cpp36
-rw-r--r--test/Lexer/has_feature_c1x.c20
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp11
-rw-r--r--test/Lexer/has_feature_type_traits.cpp10
6 files changed, 108 insertions, 7 deletions
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
index b03fb23..f54b6a4 100644
--- a/test/Lexer/block_cmt_end.c
+++ b/test/Lexer/block_cmt_end.c
@@ -1,7 +1,7 @@
/*
RUN: %clang_cc1 -E -trigraphs %s | grep bar
RUN: %clang_cc1 -E -trigraphs %s | grep foo
- RUN: %clang_cc1 -E -trigraphs %s | not grep abc
+ RUN: %clang_cc1 -E -trigraphs %s | not grep qux
RUN: %clang_cc1 -E -trigraphs %s | not grep xyz
RUN: %clang_cc1 -fsyntax-only -trigraphs -verify %s
*/
@@ -9,7 +9,7 @@
// This is a simple comment, /*/ does not end a comment, the trailing */ does.
int i = /*/ */ 1;
-/* abc
+/* qux
next comment ends with normal escaped newline:
*/
@@ -32,7 +32,3 @@ foo
// rdar://6060752 - We should not get warnings about trigraphs in comments:
// '????'
/* ???? */
-
-
-
-
diff --git a/test/Lexer/has_extension.c b/test/Lexer/has_extension.c
new file mode 100644
index 0000000..bc75a4a
--- /dev/null
+++ b/test/Lexer/has_extension.c
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s
+// RUN: %clang_cc1 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s
+
+// CHECK-PED-NONE: no_dummy_extension
+#if !__has_extension(dummy_extension)
+int no_dummy_extension();
+#endif
+
+// Arbitrary feature to test that has_extension is a superset of has_feature
+// CHECK-PED-NONE: attribute_overloadable
+#if __has_extension(attribute_overloadable)
+int attribute_overloadable();
+#endif
+
+// CHECK-PED-NONE: has_c_static_assert
+// CHECK-PED-ERR: no_c_static_assert
+#if __has_extension(c_static_assert)
+int has_c_static_assert();
+#else
+int no_c_static_assert();
+#endif
+
+// CHECK-PED-NONE: has_c_generic_selections
+// CHECK-PED-ERR: no_c_generic_selections
+#if __has_extension(c_generic_selections)
+int has_c_generic_selections();
+#else
+int no_c_generic_selections();
+#endif
+
diff --git a/test/Lexer/has_extension_cxx.cpp b/test/Lexer/has_extension_cxx.cpp
new file mode 100644
index 0000000..77efa35
--- /dev/null
+++ b/test/Lexer/has_extension_cxx.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck %s
+
+// CHECK: c_static_assert
+#if __has_extension(c_static_assert)
+int c_static_assert();
+#endif
+
+// CHECK: c_generic_selections
+#if __has_extension(c_generic_selections)
+int c_generic_selections();
+#endif
+
+// CHECK: has_deleted_functions
+#if __has_extension(cxx_deleted_functions)
+int has_deleted_functions();
+#endif
+
+// CHECK: has_inline_namespaces
+#if __has_extension(cxx_inline_namespaces)
+int has_inline_namespaces();
+#endif
+
+// CHECK: has_override_control
+#if __has_extension(cxx_override_control)
+int has_override_control();
+#endif
+
+// CHECK: has_reference_qualified_functions
+#if __has_extension(cxx_reference_qualified_functions)
+int has_reference_qualified_functions();
+#endif
+
+// CHECK: has_rvalue_references
+#if __has_extension(cxx_rvalue_references)
+int has_rvalue_references();
+#endif
diff --git a/test/Lexer/has_feature_c1x.c b/test/Lexer/has_feature_c1x.c
new file mode 100644
index 0000000..6c0fb21
--- /dev/null
+++ b/test/Lexer/has_feature_c1x.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -E -std=c1x %s -o - | FileCheck --check-prefix=CHECK-1X %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+
+#if __has_feature(c_static_assert)
+int has_static_assert();
+#else
+int no_static_assert();
+#endif
+
+// CHECK-1X: has_static_assert
+// CHECK-NO-1X: no_static_assert
+
+#if __has_feature(c_generic_selections)
+int has_generic_selections();
+#else
+int no_generic_selections();
+#endif
+
+// CHECK-1X: has_generic_selections
+// CHECK-NO-1X: no_generic_selections
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index 57949e3..ca5f868 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -17,7 +17,7 @@ int has_nullptr();
int no_nullptr();
#endif
-// CHECK-0X: no_nullptr
+// CHECK-0X: has_nullptr
// CHECK-NO-0X: no_nullptr
@@ -155,3 +155,12 @@ int no_override_control();
// CHECK-0X: has_override_control
// CHECK-NO-0X: no_override_control
+
+#if __has_feature(cxx_alias_templates)
+int has_alias_templates();
+#else
+int no_alias_templates();
+#endif
+
+// CHECK-0X: has_alias_templates
+// CHECK-NO-0X: no_alias_templates
diff --git a/test/Lexer/has_feature_type_traits.cpp b/test/Lexer/has_feature_type_traits.cpp
index 3cfc602..5da845f 100644
--- a/test/Lexer/has_feature_type_traits.cpp
+++ b/test/Lexer/has_feature_type_traits.cpp
@@ -89,3 +89,13 @@ int is_union();
int is_literal();
#endif
// CHECK: int is_literal();
+
+#if __has_feature(is_standard_layout)
+int is_standard_layout();
+#endif
+// CHECK: int is_standard_layout();
+
+#if __has_feature(is_trivially_copyable)
+int is_trivially_copyable();
+#endif
+// CHECK: int is_trivially_copyable();
OpenPOWER on IntegriCloud