From: Yunzhong Gao Date: Sat, 12 Apr 2014 02:25:32 +0000 (+0000) Subject: Add description about the __is_identifier() macro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c573acccd2baaff713f742ab2f1cea9b5b919b67;p=clang Add description about the __is_identifier() macro git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206099 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index 392e679f15..899ce728ba 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -134,6 +134,26 @@ The attribute name can also be specified with a preceding and following ``__`` (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 ============================