<li><a href="#cxx_exceptions">C++ exceptions</a></li>
<li><a href="#cxx_rtti">C++ RTTI</a></li>
</ul>
+<li><a href="#checking_upcoming_features">Checks for Upcoming Standard Language Features</a></li>
+ <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_deleted_functions">C++0x deleted functions</a></li>
+ <li><a href="#cxx_concepts">C++ TR concepts</a></li>
+ <li><a href="#cxx_lambdas">C++0x lambdas</a></li>
+ <li><a href="#cxx_nullptr">C++0x nullptr</a></li>
+ <li><a href="#cxx_rvalue_references">C++0x rvalue references</a></li>
+ <li><a href="#cxx_static_assert">C++0x <tt>static_assert()</tt></a></li>
+ <li><a href="#cxx_auto_type">C++0x type inference</a></li>
+ <li><a href="#cxx_variadic_templates">C++0x variadic templates</a></li>
+ </ul>
<li><a href="#blocks">Blocks</a></li>
<li><a href="#overloading-in-c">Function Overloading in C</a></li>
<li><a href="#builtins">Builtin Functions</a>
<p>Use <tt>__has_feature(cxx_rtti)</tt> to determine if C++ RTTI has been enabled. For example,
compiling code with <tt>-fno-rtti</tt> disables the use of RTTI.</p>
+<!-- ======================================================================= -->
+<h2 id="checking_upcoming_features">Checks for Upcoming Standard Language Features</h2>
+<!-- ======================================================================= -->
+
+<p>The <tt>__has_feature</tt> macro can be used to query if certain upcoming
+standard language features are enabled. Those features are listed here.</p>
+
+<p>Currently, all features listed here are slated for inclusion in the upcoming
+C++0x standard. As a result, all the features that clang supports are enabled
+with the <tt>-std=c++0x</tt> option when compiling C++ code. Features that are
+not yet implemented will be noted.</p>
+
+<h3 id="cxx_decltype">C++0x <tt>decltype()</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_decltype)</tt> to determine if support for the
+<tt>decltype()</tt> specifier is enabled.</p>
+
+<h3 id="cxx_attributes">C++0x attributes</h3>
+
+<p>Use <tt>__has_feature(cxx_attributes)</tt> to determine if support for
+attribute parsing with C++0x's square bracket notation is enabled.
+
+<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
+deleted function definitions (with <tt>= delete</tt>) is enabled.
+
+<h3 id="cxx_concepts">C++ TR <tt>concepts</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_lambdas)</tt> to determine if support for
+concepts is enabled. clang does not currently implement this feature.
+
+<h3 id="cxx_lambdas">C++0x <tt>nullptr</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_lambdas)</tt> to determine if support for
+lambdas is enabled. clang does not currently implement this feature.
+
+<h3 id="cxx_nullptr">C++0x <tt>nullptr</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_nullptr)</tt> to determine if support for
+<tt>nullptr</tt> is enabled. clang does not yet fully implement this feature.
+
+<h3 id="cxx_rvalue_references">C++0x rvalue references</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_rvalue_references)</tt> to determine if support for
+rvalue references is enabled. clang does not yet fully implement this feature.
+
+<h3 id="cxx_static_assert">C++0x <tt>static_assert()</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_static_assert)</tt> to determine if support for
+compile-time assertions using <tt>static_assert</tt> is enabled.</p>
+
+<h3 id="cxx_auto_type">C++0x type inference</h3>
+
+<p>Use <tt>__has_feature(cxx_auto_type)</tt> to determine C++0x type inference
+is supported using the <tt>auto</tt> specifier. If this is disabled,
+<tt>auto</tt> will instead be a storage class specifier, as in C or C++98.</p>
+
+<h3 id="cxx_variadic_templates">C++0x variadic templates</tt></h3>
+
+<p>Use <tt>__has_feature(cxx_variadic_templates)</tt> to determine if support
+for templates taking any number of arguments with the ellipsis notation is
+enabled. clang does not yet fully implement this feature.</p>
+
<!-- ======================================================================= -->
<h2 id="blocks">Blocks</h2>
<!-- ======================================================================= -->
return llvm::StringSwitch<bool>(II->getName())
.Case("blocks", LangOpts.Blocks)
.Case("cxx_rtti", LangOpts.RTTI)
+ //.Case("cxx_lambdas", false)
+ //.Case("cxx_nullptr", false)
+ //.Case("cxx_concepts", false)
+ .Case("cxx_decltype", LangOpts.CPlusPlus0x)
+ .Case("cxx_auto_type", LangOpts.CPlusPlus0x)
.Case("cxx_exceptions", LangOpts.Exceptions)
+ .Case("cxx_attributes", LangOpts.CPlusPlus0x)
+ .Case("cxx_static_assert", LangOpts.CPlusPlus0x)
.Case("objc_nonfragile_abi", LangOpts.ObjCNonFragileABI)
+ .Case("cxx_deleted_functions", LangOpts.CPlusPlus0x)
+ //.Case("cxx_rvalue_references", false)
.Case("attribute_overloadable", true)
+ //.Case("cxx_variadic_templates", false)
.Case("attribute_ext_vector_type", true)
.Case("attribute_analyzer_noreturn", true)
.Case("attribute_ns_returns_retained", true)
--- /dev/null
+// RUN: %clang -E -std=c++0x %s -o - | FileCheck --check-prefix=CHECK-0X %s
+// RUN: %clang -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
+
+#if __has_feature(cxx_lambdas)
+int lambdas();
+#else
+int no_lambdas();
+#endif
+
+// CHECK-0X: no_lambdas
+// CHECK-NO-0X: no_lambdas
+
+
+#if __has_feature(cxx_nullptr)
+int nullptr();
+#else
+int no_nullptr();
+#endif
+
+// CHECK-0X: no_nullptr
+// CHECK-NO-0X: no_nullptr
+
+
+#if __has_feature(cxx_concepts)
+int concepts();
+#else
+int no_concepts();
+#endif
+
+// CHECK-0X: no_concepts
+// CHECK-NO-0X: no_concepts
+
+
+#if __has_feature(cxx_decltype)
+int decltype();
+#else
+int no_decltype();
+#endif
+
+// CHECK-0X: decltype
+// CHECK-NO-0X: no_decltype
+
+
+#if __has_feature(cxx_auto_type)
+int auto_type();
+#else
+int no_auto_type();
+#endif
+
+// CHECK-0X: auto_type
+// CHECK-NO-0X: no_auto_type
+
+
+#if __has_feature(cxx_attributes)
+int attributes();
+#else
+int no_attributes();
+#endif
+
+// CHECK-0X: attributes
+// CHECK-NO-0X: no_attributes
+
+
+#if __has_feature(cxx_static_assert)
+int static_assert();
+#else
+int no_static_assert();
+#endif
+
+// CHECK-0X: static_assert
+// CHECK-NO-0X: no_static_assert
+
+
+#if __has_feature(cxx_deleted_functions)
+int deleted_functions();
+#else
+int no_deleted_functions();
+#endif
+
+// CHECK-0X: deleted_functions
+// CHECK-NO-0X: no_deleted_functions
+
+
+#if __has_feature(cxx_rvalue_references)
+int rvalue_references();
+#else
+int no_rvalue_references();
+#endif
+
+// CHECK-0X: no_rvalue_references
+// CHECK-NO-0X: no_rvalue_references
+
+
+#if __has_feature(cxx_variadic_templates)
+int variadic_templates();
+#else
+int no_variadic_templates();
+#endif
+
+// CHECK-0X: no_variadic_templates
+// CHECK-NO-0X: no_variadic_templates