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
24 lines
820 B
C++
24 lines
820 B
C++
// RUN: %clang_analyze_cc1 %s \
|
|
// RUN: -analyzer-checker=core \
|
|
// RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions \
|
|
// RUN: -analyzer-config apiModeling.StdCLibraryFunctions:DisplayLoadedSummaries=true \
|
|
// RUN: -analyzer-checker=debug.ExprInspection \
|
|
// RUN: -analyzer-config eagerly-assume=false \
|
|
// RUN: -triple i686-unknown-linux 2>&1 | FileCheck %s
|
|
|
|
// CHECK: Loaded summary for: size_t fread(void *, size_t, size_t, FILE *)
|
|
// CHECK-NOT: Loaded summary for: size_t fread(void *, size_t, size_t, MyFile *)
|
|
|
|
typedef unsigned int size_t;
|
|
typedef struct FILE FILE;
|
|
size_t fread(void *, size_t, size_t, FILE *);
|
|
|
|
struct MyFile;
|
|
size_t fread(void *, size_t, size_t, MyFile *);
|
|
|
|
// Must have at least one call expression to initialize the summary map.
|
|
int bar(void);
|
|
void foo() {
|
|
bar();
|
|
}
|