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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 05:55:19 PDT 2020


martong added a comment.

In D83407#2141075 <https://reviews.llvm.org/D83407#2141075>, @balazske wrote:

> Are not some functions missing from the list (`shutdown`, `sockatmark`, `socket`) (these come from //<sys/socket.h>//)? And `getnameinfo` comes from //<netdb.h>// with many other functions that are not added.


Yes, there are missing functions, this is not a comprehensive list. I try to be careful in the sense that I am adding only those functions that have a summary in Cppcheck because those constraints are already validated by their community. Of course, the list can be extended anytime, contributions are welcome from anybody.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1722
+          ACtx.getPointerType(StructSockaddrTy->withConst());
+      StructSockaddrPtrRestrictTy =
+          ACtx.getLangOpts().C99 ? ACtx.getRestrictType(*StructSockaddrPtrTy)
----------------
balazske wrote:
> There could be a generic form of getting the restrict type for a type so something like this can be done (this is used relatively often):
> `getRestrictTypeIfApplicable(ACtx, StructSockaddrPtrTy)`
> 
Yes, absolutely, good idea!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83407/new/

https://reviews.llvm.org/D83407





More information about the cfe-commits mailing list