diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2016-04-13 13:55:58 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2016-04-13 13:55:58 +0000 |
commit | 9c7fd406fcd23502fc5746b7ff03711ed81c90bd (patch) | |
tree | 61c71047c78af362111701fc50b296471e0b94b0 /include/clang/Basic/Builtins.h | |
parent | ebcac979c82e51235cd0a9c4ab16e605ef2a3aae (diff) |
Add functions declared in ctype.h to builtin function database. All functions are annotated with nothrow and pure attribute, which enables better optimization.
Patch by Taewook Oh.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Builtins.h')
-rw-r--r-- | include/clang/Basic/Builtins.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index 5917843f29..8938e191bb 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -89,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 { @@ -155,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 { |