[analyzer] StdLibraryFunctionsChecker: Add support to lookup types
authorGabor Marton <gabor.marton@ericsson.com>
Fri, 15 May 2020 09:25:40 +0000 (11:25 +0200)
committerGabor Marton <gabor.marton@ericsson.com>
Fri, 29 May 2020 15:42:05 +0000 (17:42 +0200)
commit634258b80606c4bb8192077239a089ae5842781a
tree4fd1701a9d6ff1248272dde5064a903ca5e454d7
parent9e0b52e2e68412a9a2add18697f4246e5e5ee5e3
[analyzer] StdLibraryFunctionsChecker: Add support to lookup types

Summary:
In this patch I am trying to get rid of the `Irrelevant` types from the
signatures of the functions from the standard C library. For that I've
introduced `lookupType()` to be able to lookup arbitrary types in the global
scope. This makes it possible to define the signatures precisely.

Note 1) `fread`'s signature is now fixed to have the proper `FILE *restrict`
type when C99 is the language.
Note 2) There are still existing `Irrelevant` types, but they are all from
POSIX. I am planning to address those together with the missing POSIX functions
(in D79433).

Reviewers: xazax.hun, NoQ, Szelethus, balazske

Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80016
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
clang/test/Analysis/std-c-library-functions-arg-constraints.c
clang/test/Analysis/std-c-library-functions-lookup.c [new file with mode: 0644]
clang/test/Analysis/std-c-library-functions-lookup.cpp [new file with mode: 0644]
clang/test/Analysis/std-c-library-functions.c