[analyzer] __mempcpy_chk is the same as mempcpy (at least to CStringChecker)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132605 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 8eb6d46..0eec34a 100644
--- a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -1237,7 +1237,7 @@
FnCheck evalFunction = llvm::StringSwitch<FnCheck>(Name)
.Cases("memcpy", "__memcpy_chk", &CStringChecker::evalMemcpy)
- .Case("mempcpy", &CStringChecker::evalMempcpy)
+ .Cases("mempcpy", "__mempcpy_chk", &CStringChecker::evalMempcpy)
.Cases("memcmp", "bcmp", &CStringChecker::evalMemcmp)
.Cases("memmove", "__memmove_chk", &CStringChecker::evalMemmove)
.Cases("strcpy", "__strcpy_chk", &CStringChecker::evalStrcpy)
diff --git a/test/Analysis/bstring.c b/test/Analysis/bstring.c
index 1f6839d..d74be0f 100644
--- a/test/Analysis/bstring.c
+++ b/test/Analysis/bstring.c
@@ -140,9 +140,22 @@
// mempcpy()
//===----------------------------------------------------------------------===
+#ifdef VARIANT
+
+#define __mempcpy_chk BUILTIN(__mempcpy_chk)
+void *__mempcpy_chk(void *restrict s1, const void *restrict s2, size_t n,
+ size_t destlen);
+
+#define mempcpy(a,b,c) __mempcpy_chk(a,b,c,(size_t)-1)
+
+#else /* VARIANT */
+
#define mempcpy BUILTIN(mempcpy)
void *mempcpy(void *restrict s1, const void *restrict s2, size_t n);
+#endif /* VARIANT */
+
+
void mempcpy0 () {
char src[] = {1, 2, 3, 4};
char dst[5] = {0};