aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-05 20:35:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-05 20:35:30 +0000
commit0750800623dc6d14c4c0c721996ffd4210fcdff3 (patch)
tree3981e351b845b340be5363123e7f6a0541bb1a97
parent5ffcf5de8f2b9924d3dbdf4e81f71fa2c2f5ceac (diff)
Add a __has_feature check for default template arguments in function
templates, a C++0x feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124973 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/LanguageExtensions.html5
-rw-r--r--lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp9
3 files changed, 15 insertions, 0 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html
index 8b6b96f6f2..8f412c6365 100644
--- a/docs/LanguageExtensions.html
+++ b/docs/LanguageExtensions.html
@@ -34,6 +34,7 @@ td {
<ul>
<li><a href="#cxx_attributes">C++0x attributes</a></li>
<li><a href="#cxx_decltype">C++0x <tt>decltype()</tt></a></li>
+ <li><a href="#cxx_default_function_template_args">C++0x default template arguments in function templates</a></li>
<li><a href="#cxx_deleted_functions">C++0x deleted functions</a></li>
<li><a href="#cxx_lambdas">C++0x lambdas</a></li>
<li><a href="#cxx_nullptr">C++0x nullptr</a></li>
@@ -381,6 +382,10 @@ not yet implemented will be noted.</p>
<p>Use <tt>__has_feature(cxx_attributes)</tt> to determine if support for
attribute parsing with C++0x's square bracket notation is enabled.</p>
+<h3 id="cxx_default_function_template_args">C++0x default template arguments in function templates</h3>
+
+<p>Use <tt>__has_feature(cxx_default_function_template_args)</tt> to determine if support for default template arguments in function templates is enabled.</p>
+
<h3 id="cxx_deleted_functions">C++0x deleted functions</tt></h3>
<p>Use <tt>__has_feature(cxx_deleted_functions)</tt> to determine if support for
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 4a719cac6c..cc294ee266 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -555,6 +555,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("cxx_attributes", LangOpts.CPlusPlus0x)
//.Case("cxx_auto_type", false)
.Case("cxx_decltype", LangOpts.CPlusPlus0x)
+ .Case("cxx_default_function_template_args", LangOpts.CPlusPlus0x)
.Case("cxx_deleted_functions", LangOpts.CPlusPlus0x)
.Case("cxx_inline_namespaces", LangOpts.CPlusPlus0x)
//.Case("cxx_lambdas", false)
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index 2944ae374c..21950148cf 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -109,3 +109,12 @@ int no_reference_qualified_functions();
// CHECK-0X: has_reference_qualified_functions
// CHECK-NO-0X: no_reference_qualified_functions
+#if __has_feature(cxx_default_function_template_args)
+int has_default_function_template_args();
+#else
+int no_default_function_template_args();
+#endif
+
+// CHECK-0X: has_default_function_template_args
+// CHECK-NO-0X: no_default_function_template_args
+