diff options
Diffstat (limited to 'include/clang/Basic/Builtins.h')
-rw-r--r-- | include/clang/Basic/Builtins.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index c0a6af9e26254..15e9a413fb420 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -31,11 +31,12 @@ class QualType; class LangOptions; enum LanguageID { - GNU_LANG = 0x1, // builtin requires GNU mode. - C_LANG = 0x2, // builtin for c only. - CXX_LANG = 0x4, // builtin for cplusplus only. - OBJC_LANG = 0x8, // builtin for objective-c and objective-c++ - MS_LANG = 0x10, // builtin requires MS mode. + GNU_LANG = 0x1, // builtin requires GNU mode. + C_LANG = 0x2, // builtin for c only. + CXX_LANG = 0x4, // builtin for cplusplus only. + OBJC_LANG = 0x8, // builtin for objective-c and objective-c++ + MS_LANG = 0x10, // builtin requires MS mode. + OCLC20_LANG = 0x20, // builtin for OpenCL C only. ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages. ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode. ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode. @@ -88,11 +89,16 @@ public: return getRecord(ID).Type; } - /// \brief Return true if this function is a target-specific builtin + /// \brief Return true if this function is a target-specific builtin. bool isTSBuiltin(unsigned ID) const { return ID >= Builtin::FirstTSBuiltin; } + /// \brief Return true if this function has no side effects. + bool isPure(unsigned ID) const { + return strchr(getRecord(ID).Attributes, 'U') != nullptr; + } + /// \brief Return true if this function has no side effects and doesn't /// read memory. bool isConst(unsigned ID) const { @@ -154,7 +160,7 @@ public: /// \brief Completely forget that the given ID was ever considered a builtin, /// e.g., because the user provided a conflicting signature. void forgetBuiltin(unsigned ID, IdentifierTable &Table); - + /// \brief If this is a library function that comes from a specific /// header, retrieve that header name. const char *getHeaderName(unsigned ID) const { @@ -213,7 +219,10 @@ private: /// \brief Kinds of BuiltinTemplateDecl. enum BuiltinTemplateKind : int { /// \brief This names the __make_integer_seq BuiltinTemplateDecl. - BTK__make_integer_seq + BTK__make_integer_seq, + + /// \brief This names the __type_pack_element BuiltinTemplateDecl. + BTK__type_pack_element }; } // end namespace clang |