r206099 - Add description about the __is_identifier() macro

Yunzhong Gao Yunzhong_Gao at playstation.sony.com
Fri Apr 11 19:25:33 PDT 2014


Author: ygao
Date: Fri Apr 11 21:25:32 2014
New Revision: 206099

URL: http://llvm.org/viewvc/llvm-project?rev=206099&view=rev
Log:
Add description about the __is_identifier() macro

Modified:
    cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=206099&r1=206098&r2=206099&view=diff
==============================================================================
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Fri Apr 11 21:25:32 2014
@@ -134,6 +134,26 @@ The attribute name can also be specified
 (double underscore) to avoid interference from a macro with the same name.  For
 instance, ``__always_inline__`` can be used instead of ``always_inline``.
 
+``__is_identifier``
+-------------------
+
+This function-like macro takes a single identifier argument that might be either
+a reserved word or a regular identifier. It evaluates to 1 if the argument is just
+a regular identifier and not a reserved word, in the sense that it can then be
+used as the name of a user-defined function or variable. Otherwise it evaluates
+to 0.  It can be used like this:
+
+.. code-block:: c++
+
+  ...
+  #ifdef __is_identifier          // Compatibility with non-clang compilers.
+    #if __is_identifier(__wchar_t)
+      typedef wchar_t __wchar_t;
+    #endif
+  #endif
+
+  __wchar_t WideCharacter;
+  ...
 
 Include File Checking Macros
 ============================





More information about the cfe-commits mailing list