diff options
| author | Anna Zaks <ganna@apple.com> | 2012-01-17 00:37:07 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2012-01-17 00:37:07 +0000 |
| commit | 0a151a137a68bb656acbcce7ff2407613bb80cfc (patch) | |
| tree | 129f7d790b7cec9541c6d152fd876f451dd2c131 /include | |
| parent | 022b3f4490bbdcde7b3f18ce0498f9a73b6cbf53 (diff) | |
| download | clang-0a151a137a68bb656acbcce7ff2407613bb80cfc.tar.gz clang-0a151a137a68bb656acbcce7ff2407613bb80cfc.tar.bz2 clang-0a151a137a68bb656acbcce7ff2407613bb80cfc.tar.xz | |
Use Builtin ID as the return value
for FunctionDecl::getMemoryFunctionKind().
This is a follow up on the Chris's review for r148142: We don't want to
pollute FunctionDecl with an extra enum. (To make this work, added
memcmp and family to the library builtins.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
| -rw-r--r-- | include/clang/AST/Decl.h | 25 | ||||
| -rw-r--r-- | include/clang/Basic/Builtins.def | 5 | ||||
| -rw-r--r-- | include/clang/Sema/Sema.h | 2 |
3 files changed, 11 insertions, 21 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 5c6b447f91..4016c2085f 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1986,26 +1986,11 @@ public: /// definition of a member function. virtual bool isOutOfLine() const; - /// \brief Enumeration used to identify memory setting or copying functions - /// identified by getMemoryFunctionKind(). - enum MemoryFunctionKind { - MFK_Memset, - MFK_Memcpy, - MFK_Memmove, - MFK_Memcmp, - MFK_Strncpy, - MFK_Strncmp, - MFK_Strncasecmp, - MFK_Strncat, - MFK_Strndup, - MFK_Strlcpy, - MFK_Strlcat, - MFK_Invalid - }; - - /// \brief If the given function is a memory copy or setting function, return - /// it's kind. If the function is not a memory function, returns MFK_Invalid. - MemoryFunctionKind getMemoryFunctionKind(); + /// \brief Identify a memory copying or setting function. + /// If the given function is a memory copy or setting function, returns + /// the corresponding Builtin ID. If the function is not a memory function, + /// returns 0. + unsigned getMemoryFunctionKind(); // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 5942e53eaf..e3e2d7c26b 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -631,9 +631,12 @@ LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) // C99 string.h LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) @@ -678,6 +681,8 @@ LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_LANGUAGES) +LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_LANGUAGES) +LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_LANGUAGES) // POSIX unistd.h LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES) LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES) diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index c4af62530a..242af88c89 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -6315,7 +6315,7 @@ private: bool isPrintf); void CheckMemaccessArguments(const CallExpr *Call, - FunctionDecl::MemoryFunctionKind CMF, + unsigned BId, IdentifierInfo *FnName); void CheckStrlcpycatArguments(const CallExpr *Call, |
