[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / std-c-library-functions-arg-constraints-tracking-notes.c
blobafdff5b2ffac0bcd693d9d2575ddc180b1546a7b
1 // Check the bugpath related to the reports.
2 // RUN: %clang_analyze_cc1 %s \
3 // RUN: -analyzer-checker=core \
4 // RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions \
5 // RUN: -analyzer-checker=alpha.unix.StdCLibraryFunctionArgs \
6 // RUN: -analyzer-checker=debug.StdCLibraryFunctionsTester \
7 // RUN: -analyzer-checker=debug.ExprInspection \
8 // RUN: -triple x86_64-unknown-linux-gnu \
9 // RUN: -analyzer-output=text \
10 // RUN: -verify=bugpath
12 typedef typeof(sizeof(int)) size_t;
14 int __buf_size_arg_constraint(const void *, size_t);
15 void test_buf_size_concrete(void) {
16 char buf[3]; // bugpath-note{{'buf' initialized here}}
17 int s = 4; // bugpath-note{{'s' initialized to 4}}
18 __buf_size_arg_constraint(buf, s); // \
19 // bugpath-warning{{Function argument constraint is not satisfied}} \
20 // bugpath-note{{}} \
21 // bugpath-note{{Function argument constraint is not satisfied}}
24 int __buf_size_arg_constraint_mul(const void *, size_t, size_t);
25 void test_buf_size_concrete_with_multiplication(void) {
26 short buf[3]; // bugpath-note{{'buf' initialized here}}
27 int s1 = 4; // bugpath-note{{'s1' initialized to 4}}
28 int s2 = sizeof(short); // bugpath-note{{'s2' initialized to}}
29 __buf_size_arg_constraint_mul(buf, s1, s2); // \
30 // bugpath-warning{{Function argument constraint is not satisfied}} \
31 // bugpath-note{{}} \
32 // bugpath-note{{Function argument constraint is not satisfied}}