rebase of the patch

This commit is contained in:
Sylvestre Ledru 2018-09-06 23:37:11 +02:00
parent 30cfee7c7b
commit 39260d24ef

View File

@ -7,11 +7,11 @@
clang/test/Sema/warn-strlcpycat-size.c | 55 --------------
6 files changed, 25 insertions(+), 78 deletions(-)
Index: llvm-toolchain-7_7~+rc1/clang/include/clang/Basic/Builtins.def
Index: llvm-toolchain-snapshot_8~svn341588/clang/include/clang/Basic/Builtins.def
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/include/clang/Basic/Builtins.def
+++ llvm-toolchain-7_7~+rc1/clang/include/clang/Basic/Builtins.def
@@ -503,8 +503,8 @@ BUILTIN(__builtin___memset_chk, "v*v*izz
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/include/clang/Basic/Builtins.def
+++ llvm-toolchain-snapshot_8~svn341588/clang/include/clang/Basic/Builtins.def
@@ -517,8 +517,8 @@ BUILTIN(__builtin___memset_chk, "v*v*izz
BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
@ -22,7 +22,7 @@ Index: llvm-toolchain-7_7~+rc1/clang/include/clang/Basic/Builtins.def
BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
@@ -952,8 +952,8 @@ LIBBUILTIN(getcontext, "iK*", "fj",
@@ -968,8 +968,8 @@ LIBBUILTIN(getcontext, "iK*", "fj",
LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
// non-standard but very common
@ -33,11 +33,11 @@ Index: llvm-toolchain-7_7~+rc1/clang/include/clang/Basic/Builtins.def
// id objc_msgSend(id, SEL, ...)
LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG)
// long double objc_msgSend_fpret(id self, SEL op, ...)
Index: llvm-toolchain-7_7~+rc1/clang/lib/AST/Decl.cpp
Index: llvm-toolchain-snapshot_8~svn341588/clang/lib/AST/Decl.cpp
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/lib/AST/Decl.cpp
+++ llvm-toolchain-7_7~+rc1/clang/lib/AST/Decl.cpp
@@ -3591,13 +3591,13 @@ unsigned FunctionDecl::getMemoryFunction
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/lib/AST/Decl.cpp
+++ llvm-toolchain-snapshot_8~svn341588/clang/lib/AST/Decl.cpp
@@ -3639,13 +3639,13 @@ unsigned FunctionDecl::getMemoryFunction
case Builtin::BImemmove:
return Builtin::BImemmove;
@ -57,22 +57,26 @@ Index: llvm-toolchain-7_7~+rc1/clang/lib/AST/Decl.cpp
case Builtin::BI__builtin_memcmp:
case Builtin::BImemcmp:
Index: llvm-toolchain-7_7~+rc1/clang/lib/Sema/SemaChecking.cpp
Index: llvm-toolchain-snapshot_8~svn341588/clang/lib/Sema/SemaChecking.cpp
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/lib/Sema/SemaChecking.cpp
+++ llvm-toolchain-7_7~+rc1/clang/lib/Sema/SemaChecking.cpp
@@ -1224,8 +1224,8 @@ Sema::CheckBuiltinFunctionCall(FunctionD
case Builtin::BI__builtin___memcpy_chk:
case Builtin::BI__builtin___memmove_chk:
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/lib/Sema/SemaChecking.cpp
+++ llvm-toolchain-snapshot_8~svn341588/clang/lib/Sema/SemaChecking.cpp
@@ -1237,12 +1237,12 @@ Sema::CheckBuiltinFunctionCall(FunctionD
case Builtin::BI__builtin___memset_chk:
SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "memset");
break;
- case Builtin::BI__builtin___strlcat_chk:
- case Builtin::BI__builtin___strlcpy_chk:
+// case Builtin::BI__builtin___strlcat_chk:
+// case Builtin::BI__builtin___strlcpy_chk:
+/* case Builtin::BI__builtin___strlcat_chk:
SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strlcat");
break;
case Builtin::BI__builtin___strlcpy_chk:
SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strlcpy");
- break;
+ break;*/
case Builtin::BI__builtin___strncat_chk:
case Builtin::BI__builtin___strncpy_chk:
case Builtin::BI__builtin___stpncpy_chk:
@@ -4064,9 +4064,10 @@ bool Sema::CheckFunctionCall(FunctionDec
SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strncat");
break;
@@ -4094,9 +4094,10 @@ bool Sema::CheckFunctionCall(FunctionDec
return false;
// Handle memory setting and copying functions.
@ -86,10 +90,10 @@ Index: llvm-toolchain-7_7~+rc1/clang/lib/Sema/SemaChecking.cpp
CheckStrncatArguments(TheCall, FnInfo);
else
CheckMemaccessArguments(TheCall, CMId, FnInfo);
Index: llvm-toolchain-7_7~+rc1/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
Index: llvm-toolchain-snapshot_8~svn341588/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ llvm-toolchain-7_7~+rc1/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ llvm-toolchain-snapshot_8~svn341588/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -240,9 +240,9 @@ GenericTaintChecker::TaintPropagationRul
case Builtin::BIstrncpy:
case Builtin::BIstrncat:
@ -103,10 +107,10 @@ Index: llvm-toolchain-7_7~+rc1/clang/lib/StaticAnalyzer/Checkers/GenericTaintChe
case Builtin::BIstrndup:
return TaintPropagationRule(0, 1, ReturnValueIndex);
Index: llvm-toolchain-7_7~+rc1/clang/test/Sema/builtins.c
Index: llvm-toolchain-snapshot_8~svn341588/clang/test/Sema/builtins.c
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/test/Sema/builtins.c
+++ llvm-toolchain-7_7~+rc1/clang/test/Sema/builtins.c
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/test/Sema/builtins.c
+++ llvm-toolchain-snapshot_8~svn341588/clang/test/Sema/builtins.c
@@ -190,11 +190,11 @@ void test18() {
ptr = __builtin___memccpy_chk(dst, src, '\037', sizeof(src), sizeof(dst));
@ -137,17 +141,24 @@ Index: llvm-toolchain-7_7~+rc1/clang/test/Sema/builtins.c
static char buf[20];
strlcpy(buf, b, sizeof(b)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} \\
@@ -229,6 +229,7 @@ void Test19(void)
@@ -223,12 +223,13 @@ void Test19(void)
// expected-note {{change size argument to be the size of the destination}} \
// expected-warning {{'__builtin___strlcpy_chk' will always overflow; destination buffer has size 20, but size argument is 40}}
- strlcat(buf, b, sizeof(b)); // expected-warning {{size argument in 'strlcat' call appears to be size of the source; expected the size of the destination}} \
+/* strlcat(buf, b, sizeof(b)); // expected-warning {{size argument in 'strlcat' call appears to be size of the source; expected the size of the destination}} \
// expected-note {{change size argument to be the size of the destination}}
__builtin___strlcat_chk(buf, b, sizeof(b), __builtin_object_size(buf, 0)); // expected-warning {{size argument in '__builtin___strlcat_chk' call appears to be size of the source; expected the size of the destination}} \
// expected-note {{change size argument to be the size of the destination}} \
// expected-warning {{'__builtin___strlcat_chk' will always overflow destination buffer}}
+ */
// expected-warning {{'__builtin___strlcat_chk' will always overflow; destination buffer has size 20, but size argument is 40}}
+*/
}
// rdar://11076881
Index: llvm-toolchain-7_7~+rc1/clang/test/Sema/warn-strlcpycat-size.c
Index: llvm-toolchain-snapshot_8~svn341588/clang/test/Sema/warn-strlcpycat-size.c
===================================================================
--- llvm-toolchain-7_7~+rc1.orig/clang/test/Sema/warn-strlcpycat-size.c
--- llvm-toolchain-snapshot_8~svn341588.orig/clang/test/Sema/warn-strlcpycat-size.c
+++ /dev/null
@@ -1,55 +0,0 @@
-// RUN: %clang_cc1 -Wstrlcpy-strlcat-size -verify -fsyntax-only %s