diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/Builtins.def | 17 | ||||
-rw-r--r-- | include/clang/Basic/Builtins.h | 9 |
2 files changed, 24 insertions, 2 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 7a440cc708..53e77cf35b 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -67,6 +67,7 @@ // Builtin::Context class. Currently we have: // n -> nothrow // r -> noreturn +// U -> pure // c -> const // t -> signature is meaningless, use custom typechecking // F -> this is a libc/libm function with a '__builtin_' prefix added. @@ -773,6 +774,22 @@ LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) +// C99 ctype.h +LIBBUILTIN(isalnum, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isalpha, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isblank, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(iscntrl, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isgraph, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(islower, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isprint, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(ispunct, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isspace, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(isxdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES) +LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES) + // C99 // In some systems setjmp is a macro that expands to _setjmp. We undefine // it here to avoid having two identical LIBBUILTIN entries. 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 { |