diff options
Diffstat (limited to 'test/Lexer')
-rw-r--r-- | test/Lexer/cxx-features.cpp | 7 | ||||
-rw-r--r-- | test/Lexer/eof-include.c | 8 | ||||
-rw-r--r-- | test/Lexer/eof-number.c | 9 | ||||
-rw-r--r-- | test/Lexer/has_extension_cxx.cpp | 5 | ||||
-rw-r--r-- | test/Lexer/has_feature_cxx0x.cpp | 128 | ||||
-rw-r--r-- | test/Lexer/pragma-operators.cpp | 2 |
6 files changed, 114 insertions, 45 deletions
diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index 670a105..4ec4d55 100644 --- a/test/Lexer/cxx-features.cpp +++ b/test/Lexer/cxx-features.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -verify %s // RUN: %clang_cc1 -std=c++11 -verify %s -// RUN: %clang_cc1 -std=c++1y -verify %s +// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -verify %s +// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s // expected-no-diagnostics @@ -123,3 +124,7 @@ #if check(alias_templates, 0, 200704, 200704) #error "wrong value for __cpp_alias_templates" #endif + +#if check(experimental_concepts, 0, 0, CONCEPTS_TS) +#error "wrong value for __cpp_experimental_concepts" +#endif diff --git a/test/Lexer/eof-include.c b/test/Lexer/eof-include.c new file mode 100644 index 0000000..6e53788 --- /dev/null +++ b/test/Lexer/eof-include.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -verify +// vim: set binary noeol: + +// This file intentionally ends without a \n on the last line. Make sure your +// editor doesn't add one. + +// expected-error@+1{{expected "FILENAME" or <FILENAME>}} +#include <\
\ No newline at end of file diff --git a/test/Lexer/eof-number.c b/test/Lexer/eof-number.c new file mode 100644 index 0000000..d97a6fe --- /dev/null +++ b/test/Lexer/eof-number.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -Wnewline-eof +// vim: set binary noeol: + +// This file intentionally ends without a \n on the last line. Make sure your +// editor doesn't add one. + +// expected-error@+2{{unterminated conditional directive}} +// expected-warning@+1{{no newline at end of file}} +#if 0
\ No newline at end of file diff --git a/test/Lexer/has_extension_cxx.cpp b/test/Lexer/has_extension_cxx.cpp index d3483df..d1267ea 100644 --- a/test/Lexer/has_extension_cxx.cpp +++ b/test/Lexer/has_extension_cxx.cpp @@ -41,6 +41,11 @@ int has_reference_qualified_functions(); int has_rvalue_references(); #endif +// CHECK: has_variadic_templates +#if __has_extension(cxx_variadic_templates) +int has_variadic_templates(); +#endif + // CHECK: has_local_type_template_args #if __has_extension(cxx_local_type_template_args) int has_local_type_template_args(); diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index 9fb05de..dbb650e 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -1,7 +1,8 @@ // RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-11 %s // RUN: %clang_cc1 -E -triple armv7-apple-darwin -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-NO-TLS %s // RUN: %clang_cc1 -E -triple x86_64-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-NO-11 %s -// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++1y %s -o - | FileCheck --check-prefix=CHECK-1Y %s +// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++14 %s -o - | FileCheck --check-prefix=CHECK-14 %s +// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++1z %s -o - | FileCheck --check-prefix=CHECK-1Z %s #if __has_feature(cxx_atomic) int has_atomic(); @@ -9,7 +10,8 @@ int has_atomic(); int no_atomic(); #endif -// CHECK-1Y: has_atomic +// CHECK-1Z: has_atomic +// CHECK-14: has_atomic // CHECK-11: has_atomic // CHECK-NO-11: no_atomic @@ -19,7 +21,8 @@ int has_lambdas(); int no_lambdas(); #endif -// CHECK-1Y: has_lambdas +// CHECK-1Z: has_lambdas +// CHECK-14: has_lambdas // CHECK-11: has_lambdas // CHECK-NO-11: no_lambdas @@ -30,7 +33,8 @@ int has_nullptr(); int no_nullptr(); #endif -// CHECK-1Y: has_nullptr +// CHECK-1Z: has_nullptr +// CHECK-14: has_nullptr // CHECK-11: has_nullptr // CHECK-NO-11: no_nullptr @@ -41,7 +45,8 @@ int has_decltype(); int no_decltype(); #endif -// CHECK-1Y: has_decltype +// CHECK-1Z: has_decltype +// CHECK-14: has_decltype // CHECK-11: has_decltype // CHECK-NO-11: no_decltype @@ -52,7 +57,8 @@ int has_decltype_incomplete_return_types(); int no_decltype_incomplete_return_types(); #endif -// CHECK-1Y: has_decltype_incomplete_return_types +// CHECK-1Z: has_decltype_incomplete_return_types +// CHECK-14: has_decltype_incomplete_return_types // CHECK-11: has_decltype_incomplete_return_types // CHECK-NO-11: no_decltype_incomplete_return_types @@ -63,7 +69,8 @@ int has_auto_type(); int no_auto_type(); #endif -// CHECK-1Y: has_auto_type +// CHECK-1Z: has_auto_type +// CHECK-14: has_auto_type // CHECK-11: has_auto_type // CHECK-NO-11: no_auto_type @@ -74,7 +81,8 @@ int has_trailing_return(); int no_trailing_return(); #endif -// CHECK-1Y: has_trailing_return +// CHECK-1Z: has_trailing_return +// CHECK-14: has_trailing_return // CHECK-11: has_trailing_return // CHECK-NO-11: no_trailing_return @@ -85,7 +93,8 @@ int has_attributes(); int no_attributes(); #endif -// CHECK-1Y: has_attributes +// CHECK-1Z: has_attributes +// CHECK-14: has_attributes // CHECK-11: has_attributes // CHECK-NO-11: no_attributes @@ -96,7 +105,8 @@ int has_static_assert(); int no_static_assert(); #endif -// CHECK-1Y: has_static_assert +// CHECK-1Z: has_static_assert +// CHECK-14: has_static_assert // CHECK-11: has_static_assert // CHECK-NO-11: no_static_assert @@ -106,7 +116,8 @@ int has_deleted_functions(); int no_deleted_functions(); #endif -// CHECK-1Y: has_deleted_functions +// CHECK-1Z: has_deleted_functions +// CHECK-14: has_deleted_functions // CHECK-11: has_deleted_functions // CHECK-NO-11: no_deleted_functions @@ -116,7 +127,8 @@ int has_defaulted_functions(); int no_defaulted_functions(); #endif -// CHECK-1Y: has_defaulted_functions +// CHECK-1Z: has_defaulted_functions +// CHECK-14: has_defaulted_functions // CHECK-11: has_defaulted_functions // CHECK-NO-11: no_defaulted_functions @@ -126,7 +138,8 @@ int has_rvalue_references(); int no_rvalue_references(); #endif -// CHECK-1Y: has_rvalue_references +// CHECK-1Z: has_rvalue_references +// CHECK-14: has_rvalue_references // CHECK-11: has_rvalue_references // CHECK-NO-11: no_rvalue_references @@ -137,7 +150,8 @@ int has_variadic_templates(); int no_variadic_templates(); #endif -// CHECK-1Y: has_variadic_templates +// CHECK-1Z: has_variadic_templates +// CHECK-14: has_variadic_templates // CHECK-11: has_variadic_templates // CHECK-NO-11: no_variadic_templates @@ -148,7 +162,8 @@ int has_inline_namespaces(); int no_inline_namespaces(); #endif -// CHECK-1Y: has_inline_namespaces +// CHECK-1Z: has_inline_namespaces +// CHECK-14: has_inline_namespaces // CHECK-11: has_inline_namespaces // CHECK-NO-11: no_inline_namespaces @@ -159,7 +174,8 @@ int has_range_for(); int no_range_for(); #endif -// CHECK-1Y: has_range_for +// CHECK-1Z: has_range_for +// CHECK-14: has_range_for // CHECK-11: has_range_for // CHECK-NO-11: no_range_for @@ -170,7 +186,8 @@ int has_reference_qualified_functions(); int no_reference_qualified_functions(); #endif -// CHECK-1Y: has_reference_qualified_functions +// CHECK-1Z: has_reference_qualified_functions +// CHECK-14: has_reference_qualified_functions // CHECK-11: has_reference_qualified_functions // CHECK-NO-11: no_reference_qualified_functions @@ -180,7 +197,8 @@ int has_default_function_template_args(); int no_default_function_template_args(); #endif -// CHECK-1Y: has_default_function_template_args +// CHECK-1Z: has_default_function_template_args +// CHECK-14: has_default_function_template_args // CHECK-11: has_default_function_template_args // CHECK-NO-11: no_default_function_template_args @@ -190,7 +208,8 @@ int has_noexcept(); int no_noexcept(); #endif -// CHECK-1Y: has_noexcept +// CHECK-1Z: has_noexcept +// CHECK-14: has_noexcept // CHECK-11: has_noexcept // CHECK-NO-11: no_noexcept @@ -200,7 +219,8 @@ int has_override_control(); int no_override_control(); #endif -// CHECK-1Y: has_override_control +// CHECK-1Z: has_override_control +// CHECK-14: has_override_control // CHECK-11: has_override_control // CHECK-NO-11: no_override_control @@ -210,7 +230,8 @@ int has_alias_templates(); int no_alias_templates(); #endif -// CHECK-1Y: has_alias_templates +// CHECK-1Z: has_alias_templates +// CHECK-14: has_alias_templates // CHECK-11: has_alias_templates // CHECK-NO-11: no_alias_templates @@ -220,7 +241,8 @@ int has_implicit_moves(); int no_implicit_moves(); #endif -// CHECK-1Y: has_implicit_moves +// CHECK-1Z: has_implicit_moves +// CHECK-14: has_implicit_moves // CHECK-11: has_implicit_moves // CHECK-NO-11: no_implicit_moves @@ -230,7 +252,8 @@ int has_alignas(); int no_alignas(); #endif -// CHECK-1Y: has_alignas +// CHECK-1Z: has_alignas +// CHECK-14: has_alignas // CHECK-11: has_alignas // CHECK-NO-11: no_alignas @@ -240,7 +263,8 @@ int has_alignof(); int no_alignof(); #endif -// CHECK-1Y: has_alignof +// CHECK-1Z: has_alignof +// CHECK-14: has_alignof // CHECK-11: has_alignof // CHECK-NO-11: no_alignof @@ -250,7 +274,8 @@ int has_raw_string_literals(); int no_raw_string_literals(); #endif -// CHECK-1Y: has_raw_string_literals +// CHECK-1Z: has_raw_string_literals +// CHECK-14: has_raw_string_literals // CHECK-11: has_raw_string_literals // CHECK-NO-11: no_raw_string_literals @@ -260,7 +285,8 @@ int has_unicode_literals(); int no_unicode_literals(); #endif -// CHECK-1Y: has_unicode_literals +// CHECK-1Z: has_unicode_literals +// CHECK-14: has_unicode_literals // CHECK-11: has_unicode_literals // CHECK-NO-11: no_unicode_literals @@ -270,7 +296,8 @@ int has_constexpr(); int no_constexpr(); #endif -// CHECK-1Y: has_constexpr +// CHECK-1Z: has_constexpr +// CHECK-14: has_constexpr // CHECK-11: has_constexpr // CHECK-NO-11: no_constexpr @@ -280,7 +307,8 @@ int has_generalized_initializers(); int no_generalized_initializers(); #endif -// CHECK-1Y: has_generalized_initializers +// CHECK-1Z: has_generalized_initializers +// CHECK-14: has_generalized_initializers // CHECK-11: has_generalized_initializers // CHECK-NO-11: no_generalized_initializers @@ -290,7 +318,8 @@ int has_unrestricted_unions(); int no_unrestricted_unions(); #endif -// CHECK-1Y: has_unrestricted_unions +// CHECK-1Z: has_unrestricted_unions +// CHECK-14: has_unrestricted_unions // CHECK-11: has_unrestricted_unions // CHECK-NO-11: no_unrestricted_unions @@ -300,7 +329,8 @@ int has_user_literals(); int no_user_literals(); #endif -// CHECK-1Y: has_user_literals +// CHECK-1Z: has_user_literals +// CHECK-14: has_user_literals // CHECK-11: has_user_literals // CHECK-NO-11: no_user_literals @@ -310,7 +340,8 @@ int has_local_type_template_args(); int no_local_type_template_args(); #endif -// CHECK-1Y: has_local_type_template_args +// CHECK-1Z: has_local_type_template_args +// CHECK-14: has_local_type_template_args // CHECK-11: has_local_type_template_args // CHECK-NO-11: no_local_type_template_args @@ -320,7 +351,8 @@ int has_inheriting_constructors(); int no_inheriting_constructors(); #endif -// CHECK-1Y: has_inheriting_constructors +// CHECK-1Z: has_inheriting_constructors +// CHECK-14: has_inheriting_constructors // CHECK-11: has_inheriting_constructors // CHECK-NO-11: no_inheriting_constructors @@ -330,12 +362,13 @@ int has_thread_local(); int no_thread_local(); #endif -// CHECK-1Y: has_thread_local +// CHECK-1Z: has_thread_local +// CHECK-14: has_thread_local // CHECK-11: has_thread_local // CHECK-NO-11: no_thread_local // CHECK-NO-TLS: no_thread_local -// === C++1y features === +// === C++14 features === #if __has_feature(cxx_binary_literals) int has_binary_literals(); @@ -343,7 +376,8 @@ int has_binary_literals(); int no_binary_literals(); #endif -// CHECK-1Y: has_binary_literals +// CHECK-1Z: has_binary_literals +// CHECK-14: has_binary_literals // CHECK-11: no_binary_literals // CHECK-NO-11: no_binary_literals @@ -353,7 +387,8 @@ int has_aggregate_nsdmi(); int no_aggregate_nsdmi(); #endif -// CHECK-1Y: has_aggregate_nsdmi +// CHECK-1Z: has_aggregate_nsdmi +// CHECK-14: has_aggregate_nsdmi // CHECK-11: no_aggregate_nsdmi // CHECK-NO-11: no_aggregate_nsdmi @@ -363,7 +398,8 @@ int has_return_type_deduction(); int no_return_type_deduction(); #endif -// CHECK-1Y: has_return_type_deduction +// CHECK-1Z: has_return_type_deduction +// CHECK-14: has_return_type_deduction // CHECK-11: no_return_type_deduction // CHECK-NO-11: no_return_type_deduction @@ -373,7 +409,8 @@ int has_contextual_conversions(); int no_contextual_conversions(); #endif -// CHECK-1Y: has_contextual_conversions +// CHECK-1Z: has_contextual_conversions +// CHECK-14: has_contextual_conversions // CHECK-11: no_contextual_conversions // CHECK-NO-11: no_contextual_conversions @@ -383,7 +420,8 @@ int has_relaxed_constexpr(); int no_relaxed_constexpr(); #endif -// CHECK-1Y: has_relaxed_constexpr +// CHECK-1Z: has_relaxed_constexpr +// CHECK-14: has_relaxed_constexpr // CHECK-11: no_relaxed_constexpr // CHECK-NO-11: no_relaxed_constexpr @@ -393,7 +431,8 @@ int has_variable_templates(); int no_variable_templates(); #endif -// CHECK-1Y: has_variable_templates +// CHECK-1Z: has_variable_templates +// CHECK-14: has_variable_templates // CHECK-11: no_variable_templates // CHECK-NO-11: no_variable_templates @@ -403,7 +442,8 @@ int has_init_captures(); int no_init_captures(); #endif -// CHECK-1Y: has_init_captures +// CHECK-1Z: has_init_captures +// CHECK-14: has_init_captures // CHECK-11: no_init_captures // CHECK-NO-11: no_init_captures @@ -413,7 +453,8 @@ int has_decltype_auto(); int no_decltype_auto(); #endif -// CHECK-1Y: has_decltype_auto +// CHECK-1Z: has_decltype_auto +// CHECK-14: has_decltype_auto // CHECK-11: no_decltype_auto // CHECK-NO-11: no_decltype_auto @@ -423,6 +464,7 @@ int has_generic_lambdas(); int no_generic_lambdas(); #endif -// CHECK-1Y: has_generic_lambdas +// CHECK-1Z: has_generic_lambdas +// CHECK-14: has_generic_lambdas // CHECK-11: no_generic_lambdas // CHECK-NO-11: no_generic_lambdas diff --git a/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp index 7270f1e..4d288c9 100644 --- a/test/Lexer/pragma-operators.cpp +++ b/test/Lexer/pragma-operators.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fms-extensions -std=c++11 -E %s | FileCheck %s +// RUN: %clang_cc1 -fms-extensions -std=c++11 -E %s -fuse-line-directives | FileCheck %s // Test that we properly expand the C99 _Pragma and Microsoft __pragma // into #pragma directives, with newlines where needed. <rdar://problem/8412013> |