implement and document a new __has_feature and __has_builtin magic 
builtin preprocessor macro.  This appears to work with two caveats:
1) builtins are registered in -E mode, and 2) target-specific builtins
are unconditionally registered even if they aren't supported by the
target (e.g. SSE4 builtin when only SSE1 is enabled).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73289 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html
index c486562..55fb615 100644
--- a/docs/LanguageExtensions.html
+++ b/docs/LanguageExtensions.html
@@ -19,6 +19,7 @@
 
 <ul>
 <li><a href="#intro">Introduction</a></li>
+<li><a href="#feature_check">Feature Checking Macros</a></li>
 <li><a href="#builtinmacros">Builtin Macros</a></li>
 <li><a href="#vectors">Vectors and Extended Vectors</a></li>
 <li><a href="#blocks">Blocks</a></li>
@@ -45,12 +46,73 @@
 <!-- ======================================================================= -->
 
 <p>This document describes the language extensions provided by Clang.  In
-addition to the langauge extensions listed here, Clang aims to support a broad
+addition to the language extensions listed here, Clang aims to support a broad
 range of GCC extensions.  Please see the <a 
 href="http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html">GCC manual</a> for
 more information on these extensions.</p>
 
 <!-- ======================================================================= -->
+<h2 id="feature_check">Feature Checking Macros</h2>
+<!-- ======================================================================= -->
+
+<p>Language extensions can be very useful, but only if you know you can depend
+on them.  In order to allow fine-grain features checks, we support two builtin
+function-like macros.  This allows you to directly test for a feature in your
+code without having to resort to something like autoconf or fragile "compiler
+version checks".</p>
+
+<!-- ======================================================================= -->
+<h3 id="__has_builtin">__has_builtin</h3>
+<!-- ======================================================================= -->
+
+<p>This function-like macro takes a single identifier argument that is the name
+of a builtin function.  It evaluates to 1 if the builtin is supported or 0 if
+not.  It can be used like this:</p>
+
+<blockquote>
+<pre>
+#ifndef __has_builtin         // Optional of course.
+  #define __has_builtin(x) 0  // Compatibility with non-clang compilers.
+#endif
+
+...
+#if __has_builtin(__builtin_trap)
+  __builtin_trap();
+#else
+  abort();
+#endif
+...
+</pre>
+</blockquote>
+
+
+<!-- ======================================================================= -->
+<h3 id="__has_feature">__has_feature</h3>
+<!-- ======================================================================= -->
+
+<p>This function-like macro takes a single identifier argument that is the name
+of a feature.  It evaluates to 1 if the feature is supported or 0 if not.  It
+can be used like this:</p>
+
+<blockquote>
+<pre>
+#ifndef __has_feature         // Optional of course.
+  #define __has_feature(x) 0  // Compatibility with non-clang compilers.
+#endif
+
+...
+#if __has_feature(attribute_overloadable) || \
+    __has_feature(blocks)
+...
+#endif
+...
+</pre>
+</blockquote>
+
+<p>The feature tag is described along with the language feature below.</p>
+
+
+<!-- ======================================================================= -->
 <h2 id="builtinmacros">Builtin Macros</h2>
 <!-- ======================================================================= -->
 
@@ -64,6 +126,8 @@
 with V.xyzw syntax and other tidbits.  See also <a 
 href="#__builtin_shufflevector">__builtin_shufflevector</a>.</p>
 
+<p>Query for this feature with __has_feature(attribute_ext_vector_type).</p>
+
 <!-- ======================================================================= -->
 <h2 id="blocks">Blocks</h2>
 <!-- ======================================================================= -->
@@ -73,6 +137,9 @@
 details for the clang implementation are in <a 
 href="BlockImplementation.txt">BlockImplementation.txt</a>.</p>
 
+
+<p>Query for this feature with __has_feature(blocks).</p>
+
 <!-- ======================================================================= -->
 <h2 id="overloading-in-c">Function Overloading in C</h2>
 <!-- ======================================================================= -->
@@ -171,6 +238,9 @@
   C.</li>
 </ul>
 
+<p>Query for this feature with __has_feature(attribute_overloadable).</p>
+
+
 <!-- ======================================================================= -->
 <h2 id="builtins">Builtin Functions</h2>
 <!-- ======================================================================= -->
@@ -320,7 +390,10 @@
 
 <pre>
   void foo() <b>__attribute__((analyzer_noreturn))</b>;
-</p>
+</pre>
+
+<p>Query for this feature with __has_feature(attribute_analyzer_noreturn).</p>
+
 
 </div>
 </body>