[PATCH] D83407: [analyzer][StdLibraryFunctionsChecker] Add POSIX networking functions

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 8 09:53:42 PDT 2020


martong created this revision.
martong added reviewers: gamesh411, Szelethus, NoQ.
Herald added subscribers: cfe-commits, ASDenysPetrov, steakhal, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity.
Herald added a project: clang.

Adding networking functions from the POSIX standard (2017). This includes
functions that deal with sockets from socket.h, netdb.h.

In 'socket.h' of some libc implementations (e.g. glibc) with C99, sockaddr
parameter is a transparent union of the underlying sockaddr_ family of pointers
instead of being a pointer to struct sockaddr. In these cases, the standardized
signature will not match, thus we try to match with another signature that has
the joker Irrelevant type. In the case of transparent unions, we also not add
those constraints which require pointer types for the sockaddr param.

Interestingly, in 'netdb.h' sockaddr is not handled as a transparent union.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83407

Files:
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/test/Analysis/std-c-library-functions-POSIX-socket-sockaddr.cpp
  clang/test/Analysis/std-c-library-functions-POSIX.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83407.276469.patch
Type: text/x-patch
Size: 24246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/7ebe1688/attachment-0001.bin>


More information about the cfe-commits mailing list