[clang] bfc40b1 - [analyzer] Fix buildbot failure for D120369

Endre Fülöp via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 05:58:23 PST 2022


Author: Endre Fülöp
Date: 2022-03-07T14:56:04+01:00
New Revision: bfc40b1a1a2c6149e2ebcdc47ffac7d018e2b78d

URL: https://github.com/llvm/llvm-project/commit/bfc40b1a1a2c6149e2ebcdc47ffac7d018e2b78d
DIFF: https://github.com/llvm/llvm-project/commit/bfc40b1a1a2c6149e2ebcdc47ffac7d018e2b78d.diff

LOG: [analyzer] Fix buildbot failure for D120369

Fix test case for GenericTaintChecker.
Redefinition of types is a C11 feature, and it broke a buildbot.
Commit amended: 4fd6c6e65ab59f82284d8272aa3bec8d5084511e.

Added: 
    

Modified: 
    clang/test/Analysis/taint-generic.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Analysis/taint-generic.c b/clang/test/Analysis/taint-generic.c
index 0fdd05493172e..626e01e39d158 100644
--- a/clang/test/Analysis/taint-generic.c
+++ b/clang/test/Analysis/taint-generic.c
@@ -105,6 +105,13 @@ void *malloc(size_t);
 void *calloc(size_t nmemb, size_t size);
 void bcopy(void *s1, void *s2, size_t n);
 
+typedef size_t socklen_t;
+
+struct sockaddr {
+  unsigned short sa_family;
+  char sa_data[14];
+};
+
 #define BUFSIZE 10
 
 int Buffer[BUFSIZE];
@@ -437,8 +444,6 @@ int testGethostname(char *name, size_t len) {
   return system(name); // expected-warning {{Untrusted data is passed to a system call}}
 }
 
-struct sockaddr;
-typedef size_t socklen_t;
 int getnameinfo(const struct sockaddr *restrict addr, socklen_t addrlen,
                 char *restrict host, socklen_t hostlen,
                 char *restrict serv, socklen_t servlen, int flags);
@@ -506,13 +511,6 @@ void testRecv(int *buf, size_t len, int flags) {
   clang_analyzer_isTainted_int(read); // expected-warning {{YES}}
 }
 
-typedef size_t socklen_t;
-
-struct sockaddr {
-  unsigned short sa_family;
-  char sa_data[14];
-};
-
 ssize_t recvfrom(int sockfd, void *restrict buf, size_t len, int flags,
                  struct sockaddr *restrict src_addr,
                  socklen_t *restrict addrlen);


        


More information about the cfe-commits mailing list