Use ``__has_feature(cxx_alignas)`` or ``__has_extension(cxx_alignas)`` to
determine if support for alignment specifiers using ``alignas`` is enabled.
+Use ``__has_feature(cxx_alignof)`` or ``__has_extension(cxx_alignof)`` to
+determine if support for the ``alignof`` keyword is enabled.
+
C++11 attributes
^^^^^^^^^^^^^^^^
Use ``__has_feature(c_alignas)`` or ``__has_extension(c_alignas)`` to determine
if support for alignment specifiers using ``_Alignas`` is enabled.
+Use ``__has_feature(c_alignof)`` or ``__has_extension(c_alignof)`` to determine
+if support for the ``_Alignof`` keyword is enabled.
+
C11 atomic operations
^^^^^^^^^^^^^^^^^^^^^
.Case("arc_cf_code_audited", true)
// C11 features
.Case("c_alignas", LangOpts.C11)
+ .Case("c_alignof", LangOpts.C11)
.Case("c_atomic", LangOpts.C11)
.Case("c_generic_selections", LangOpts.C11)
.Case("c_static_assert", LangOpts.C11)
.Case("cxx_access_control_sfinae", LangOpts.CPlusPlus11)
.Case("cxx_alias_templates", LangOpts.CPlusPlus11)
.Case("cxx_alignas", LangOpts.CPlusPlus11)
+ .Case("cxx_alignof", LangOpts.CPlusPlus11)
.Case("cxx_atomic", LangOpts.CPlusPlus11)
.Case("cxx_attributes", LangOpts.CPlusPlus11)
.Case("cxx_auto_type", LangOpts.CPlusPlus11)
return llvm::StringSwitch<bool>(Extension)
// C11 features supported by other languages as extensions.
.Case("c_alignas", true)
+ .Case("c_alignof", true)
.Case("c_atomic", true)
.Case("c_generic_selections", true)
.Case("c_static_assert", true)
int no_c_alignas();
#endif
+// CHECK-PED-NONE: has_c_alignof
+// CHECK-PED-ERR: no_c_alignof
+#if __has_extension(c_alignof)
+int has_c_alignof();
+#else
+int no_c_alignof();
+#endif
+
// Arbitrary feature to test that the extension name can be surrounded with
// double underscores.
// CHECK-PED-NONE: has_double_underscores
#else
int no_atomic();
#endif
-
// CHECK-1X: has_atomic
// CHECK-NO-1X: no_atomic
#else
int no_static_assert();
#endif
-
// CHECK-1X: has_static_assert
// CHECK-NO-1X: no_static_assert
#else
int no_generic_selections();
#endif
-
// CHECK-1X: has_generic_selections
// CHECK-NO-1X: no_generic_selections
#else
int no_alignas();
#endif
-
// CHECK-1X: has_alignas
// CHECK-NO-1X: no_alignas
+#if __has_feature(c_alignof)
+int has_alignof();
+#else
+int no_alignof();
+#endif
+// CHECK-1X: has_alignof
+// CHECK-NO-1X: no_alignof
+
#if __has_feature(c_thread_local)
int has_thread_local();
#else
// CHECK-11: has_alignas
// CHECK-NO-11: no_alignas
+#if __has_feature(cxx_alignof)
+int has_alignof();
+#else
+int no_alignof();
+#endif
+
+// CHECK-1Y: has_alignof
+// CHECK-11: has_alignof
+// CHECK-NO-11: no_alignof
+
#if __has_feature(cxx_raw_string_literals)
int has_raw_string_literals();
#else