summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-01 01:19:34 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-01 01:19:34 +0000
commit3c469769a25a0e1dba220fcc65086575bd1e9472 (patch)
tree89da72d751ebb0bd381466c31afbd45b673cf506 /clang
parentd73f3ddb441b305dd41f4da608df3e899d4d9672 (diff)
downloadbcm5719-llvm-3c469769a25a0e1dba220fcc65086575bd1e9472.tar.gz
bcm5719-llvm-3c469769a25a0e1dba220fcc65086575bd1e9472.zip
Add __has_feature(cxx_defaulted_functions) for querying "defaulted
functions", from Michel Morin! llvm-svn: 143411
Diffstat (limited to 'clang')
-rw-r--r--clang/docs/LanguageExtensions.html7
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/test/Lexer/has_feature_cxx0x.cpp8
3 files changed, 16 insertions, 0 deletions
diff --git a/clang/docs/LanguageExtensions.html b/clang/docs/LanguageExtensions.html
index becdbfac4d1..34e205613be 100644
--- a/clang/docs/LanguageExtensions.html
+++ b/clang/docs/LanguageExtensions.html
@@ -46,6 +46,7 @@
<li><a href="#cxx_constexpr">C++11 generalized constant expressions</a></li>
<li><a href="#cxx_decltype">C++11 <tt>decltype()</tt></a></li>
<li><a href="#cxx_default_function_template_args">C++11 default template arguments in function templates</a></li>
+ <li><a href="#cxx_defaulted_functions">C++11 defaulted functions</a></li>
<li><a href="#cxx_delegating_constructor">C++11 delegating constructors</a></li>
<li><a href="#cxx_deleted_functions">C++11 deleted functions</a></li>
<li><a href="#cxx_explicit_conversions">C++11 explicit conversion functions</a></li>
@@ -509,6 +510,12 @@ enabled. Clang does not currently implement this feature.</p>
<tt>__has_extension(cxx_default_function_template_args)</tt> to determine
if support for default template arguments in function templates is enabled.</p>
+<h4 id="cxx_defaulted_functions">C++11 <tt>default</tt>ed functions</h4>
+
+<p>Use <tt>__has_feature(cxx_defaulted_functions)</tt> or
+<tt>__has_extension(cxx_defaulted_functions)</tt> to determine if support for
+defaulted function definitions (with <tt>= default</tt>) is enabled.</p>
+
<h4 id="cxx_delegating_constructors">C++11 delegating constructors</h4>
<p>Use <tt>__has_feature(cxx_delegating_constructors)</tt> to determine if
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 7557f2e0fe0..fd04b8a3794 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -628,6 +628,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
//.Case("cxx_constexpr", false);
.Case("cxx_decltype", LangOpts.CPlusPlus0x)
.Case("cxx_default_function_template_args", LangOpts.CPlusPlus0x)
+ .Case("cxx_defaulted_functions", LangOpts.CPlusPlus0x)
.Case("cxx_delegating_constructors", LangOpts.CPlusPlus0x)
.Case("cxx_deleted_functions", LangOpts.CPlusPlus0x)
.Case("cxx_explicit_conversions", LangOpts.CPlusPlus0x)
diff --git a/clang/test/Lexer/has_feature_cxx0x.cpp b/clang/test/Lexer/has_feature_cxx0x.cpp
index f2b4576b57e..eff9cfb892f 100644
--- a/clang/test/Lexer/has_feature_cxx0x.cpp
+++ b/clang/test/Lexer/has_feature_cxx0x.cpp
@@ -79,6 +79,14 @@ int no_deleted_functions();
// CHECK-0X: has_deleted_functions
// CHECK-NO-0X: no_deleted_functions
+#if __has_feature(cxx_defaulted_functions)
+int has_defaulted_functions();
+#else
+int no_defaulted_functions();
+#endif
+
+// CHECK-0X: has_defaulted_functions
+// CHECK-NO-0X: no_defaulted_functions
#if __has_feature(cxx_rvalue_references)
int has_rvalue_references();
OpenPOWER on IntegriCloud