[ELF] Avoid make in elf::writeARMCmseImportLib
[llvm-project.git] / clang / test / Analysis / std-c-library-functions-POSIX-socket-sockaddr.cpp
blob8aa370287562ae2b02565453152e79123bee7bfc
1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=unix.StdCLibraryFunctions \
4 // RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=true \
5 // RUN: -analyzer-config unix.StdCLibraryFunctions:DisplayLoadedSummaries=true \
6 // RUN: -analyzer-checker=debug.ExprInspection \
7 // RUN: -analyzer-config eagerly-assume=false \
8 // RUN: -triple i686-unknown-linux 2>&1 | FileCheck %s
10 // We test here that functions from socket.h are added when sockaddr is not a
11 // transparent union of other sockaddr_ pointers. This is the case in C++.
13 // CHECK: Loaded summary for: int accept(int socket, struct sockaddr *address, socklen_t *address_len)
14 // CHECK: Loaded summary for: int bind(int socket, const struct sockaddr *address, socklen_t address_len)
15 // CHECK: Loaded summary for: int getpeername(int socket, struct sockaddr *address, socklen_t *address_len)
16 // CHECK: Loaded summary for: int getsockname(int socket, struct sockaddr *address, socklen_t *address_len)
17 // CHECK: Loaded summary for: int connect(int socket, const struct sockaddr *address, socklen_t address_len)
18 // CHECK: Loaded summary for: ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
19 // CHECK: Loaded summary for: ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
21 struct sockaddr;
22 using socklen_t = unsigned;
23 int accept(int socket, struct sockaddr *address, socklen_t *address_len);
24 int bind(int socket, const struct sockaddr *address, socklen_t address_len);
25 int getpeername(int socket, struct sockaddr *address, socklen_t *address_len);
26 int getsockname(int socket, struct sockaddr *address, socklen_t *address_len);
27 int connect(int socket, const struct sockaddr *address, socklen_t address_len);
28 typedef decltype(sizeof(int)) size_t;
29 typedef size_t ssize_t;
30 ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len);
31 ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
33 // Must have at least one call expression to initialize the summary map.
34 int bar(void);
35 void foo() {
36 bar();