[cfe-commits] r142020 - in /cfe/trunk: docs/LanguageExtensions.html lib/Lex/PPMacroExpansion.cpp test/Lexer/has_extension.c test/Lexer/has_feature_c1x.c test/Lexer/has_feature_cxx0x.cpp
Peter Collingbourne
peter at pcc.me.uk
Fri Oct 14 16:44:46 PDT 2011
Author: pcc
Date: Fri Oct 14 18:44:46 2011
New Revision: 142020
URL: http://llvm.org/viewvc/llvm-project?rev=142020&view=rev
Log:
Add c_alignas and cxx_alignas features
Modified:
cfe/trunk/docs/LanguageExtensions.html
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/Lexer/has_extension.c
cfe/trunk/test/Lexer/has_feature_c1x.c
cfe/trunk/test/Lexer/has_feature_cxx0x.cpp
Modified: cfe/trunk/docs/LanguageExtensions.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.html?rev=142020&r1=142019&r2=142020&view=diff
==============================================================================
--- cfe/trunk/docs/LanguageExtensions.html (original)
+++ cfe/trunk/docs/LanguageExtensions.html Fri Oct 14 18:44:46 2011
@@ -40,6 +40,7 @@
<ul>
<li><a href="#cxx_access_control_sfinae">C++0x SFINAE includes access control</a></li>
<li><a href="#cxx_alias_templates">C++0x alias templates</a></li>
+ <li><a href="#cxx_alignas">C++0x alignment specifiers</a></li>
<li><a href="#cxx_attributes">C++0x attributes</a></li>
<li><a href="#cxx_constexpr">C++0x generalized constant expressions</a></li>
<li><a href="#cxx_decltype">C++0x <tt>decltype()</tt></a></li>
@@ -71,6 +72,7 @@
</ul></li>
<li><a href="#c1x">C1X</a>
<ul>
+ <li><a href="#c_alignas">C1X alignment specifiers</a></li>
<li><a href="#c_generic_selections">C1X generic selections</a></li>
<li><a href="#c_static_assert">C1X <tt>_Static_assert()</tt></a></li>
</ul></li>
@@ -476,6 +478,12 @@
<tt>__has_extension(cxx_alias_templates)</tt> to determine if support for
C++0x's alias declarations and alias templates is enabled.</p>
+<h4 id="cxx_alignas">C++0x alignment specifiers</h4>
+
+<p>Use <tt>__has_feature(cxx_alignas)</tt> or
+<tt>__has_extension(cxx_alignas)</tt> to determine if support for alignment
+specifiers using <tt>alignas</tt> is enabled.</p>
+
<h4 id="cxx_attributes">C++0x attributes</h4>
<p>Use <tt>__has_feature(cxx_attributes)</tt> or
@@ -635,6 +643,12 @@
C1X standard. As a result, all these features are enabled
with the <tt>-std=c1x</tt> option when compiling C code.</p>
+<h4 id="c_alignas">C1X alignment specifiers</h4>
+
+<p>Use <tt>__has_feature(c_alignas)</tt> or <tt>__has_extension(c_alignas)</tt>
+to determine if support for alignment specifiers using <tt>_Alignas</tt>
+is enabled.</p>
+
<h4 id="c_generic_selections">C1X generic selections</h4>
<p>Use <tt>__has_feature(c_generic_selections)</tt> or
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=142020&r1=142019&r2=142020&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Fri Oct 14 18:44:46 2011
@@ -609,11 +609,13 @@
.Case("ownership_returns", true)
.Case("ownership_takes", true)
// C1X features
+ .Case("c_alignas", LangOpts.C1X)
.Case("c_generic_selections", LangOpts.C1X)
.Case("c_static_assert", LangOpts.C1X)
// C++0x features
.Case("cxx_access_control_sfinae", LangOpts.CPlusPlus0x)
.Case("cxx_alias_templates", LangOpts.CPlusPlus0x)
+ .Case("cxx_alignas", LangOpts.CPlusPlus0x)
.Case("cxx_attributes", LangOpts.CPlusPlus0x)
.Case("cxx_auto_type", LangOpts.CPlusPlus0x)
//.Case("cxx_constexpr", false);
@@ -702,6 +704,7 @@
// must be less restrictive than HasFeature's.
return llvm::StringSwitch<bool>(II->getName())
// C1X features supported by other languages as extensions.
+ .Case("c_alignas", true)
.Case("c_generic_selections", true)
.Case("c_static_assert", true)
// C++0x features supported by other languages as extensions.
Modified: cfe/trunk/test/Lexer/has_extension.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_extension.c?rev=142020&r1=142019&r2=142020&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/has_extension.c (original)
+++ cfe/trunk/test/Lexer/has_extension.c Fri Oct 14 18:44:46 2011
@@ -28,3 +28,11 @@
int no_c_generic_selections();
#endif
+// CHECK-PED-NONE: has_c_alignas
+// CHECK-PED-ERR: no_c_alignas
+#if __has_extension(c_alignas)
+int has_c_alignas();
+#else
+int no_c_alignas();
+#endif
+
Modified: cfe/trunk/test/Lexer/has_feature_c1x.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_c1x.c?rev=142020&r1=142019&r2=142020&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/has_feature_c1x.c (original)
+++ cfe/trunk/test/Lexer/has_feature_c1x.c Fri Oct 14 18:44:46 2011
@@ -18,3 +18,12 @@
// CHECK-1X: has_generic_selections
// CHECK-NO-1X: no_generic_selections
+
+#if __has_feature(c_alignas)
+int has_alignas();
+#else
+int no_alignas();
+#endif
+
+// CHECK-1X: has_alignas
+// CHECK-NO-1X: no_alignas
Modified: cfe/trunk/test/Lexer/has_feature_cxx0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_cxx0x.cpp?rev=142020&r1=142019&r2=142020&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/has_feature_cxx0x.cpp (original)
+++ cfe/trunk/test/Lexer/has_feature_cxx0x.cpp Fri Oct 14 18:44:46 2011
@@ -173,3 +173,12 @@
// CHECK-0X: has_implicit_moves
// CHECK-NO-0X: no_implicit_moves
+
+#if __has_feature(cxx_alignas)
+int has_alignas();
+#else
+int no_alignas();
+#endif
+
+// CHECK-0X: has_alignas
+// CHECK-NO-0X: no_alignas
More information about the cfe-commits
mailing list