Home | History | Annotate | Download | only in SemaCXX

Lines Matching full:sizeof

1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-sizeof-array-argument %s
22 memcpy(&dest, &source, sizeof(dest));
37 memset(&s, 0, sizeof(&s)); // \
38 // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
39 memset(ps, 0, sizeof(ps)); // \
40 // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
41 memset(ps2, 0, sizeof(ps2)); // \
42 // expected-warning {{'memset' call operates on objects of type 'S' while the size is based on a different type 'PS' (aka 'S *')}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
43 memset(ps2, 0, sizeof(typeof(ps2))); // \
44 // expected-warning {{argument to 'sizeof' in 'memset' call is the same pointer type}}
45 memset(ps2, 0, sizeof(PS)); // \
46 // expected-warning {{argument to 'sizeof' in 'memset' call is the same pointer type}}
47 memset(heap_buffer, 0, sizeof(heap_buffer)); // \
50 memcpy(&s, 0, sizeof(&s)); // \
51 // expected-warning {{'memcpy' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
52 memcpy(0, &s, sizeof(&s)); // \
53 // expected-warning {{'memcpy' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to remove the addressof in the argument to 'sizeof' (and multiply it by the number of elements)?}}
55 memmove(ps, 0, sizeof(ps)); // \
56 // expected-warning {{'memmove' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
57 memcmp(ps, 0, sizeof(ps)); // \
58 // expected-warning {{'memcmp' call operates on objects of type 'S' while the size is based on a different type 'S *'}} expected-note{{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
61 memset((void*)&s, 0, sizeof(&s));
62 memset(&s, 0, sizeof(s));
63 memset(&s, 0, sizeof(S));
64 memset(&s, 0, sizeof(const S));
65 memset(&s, 0, sizeof(volatile S));
66 memset(&s, 0, sizeof(volatile const S));
67 memset(&foo, 0, sizeof(CFoo));
68 memset(&foo, 0, sizeof(VFoo));
69 memset(&foo, 0, sizeof(CVFoo));
70 memset(ps, 0, sizeof(*ps));
71 memset(ps2, 0, sizeof(*ps2));
72 memset(ps2, 0, sizeof(typeof(*ps2)));
73 memset(arr, 0, sizeof(arr));
74 memset(parr, 0, sizeof(parr));
76 memcpy(&foo, &const_foo, sizeof(Foo));
77 memcpy((void*)&s, 0, sizeof(&s));
78 memcpy(0, (void*)&s, sizeof(&s));
80 memcpy(&cptr, buffer, sizeof(cptr));
81 memcpy((char*)&cptr, buffer, sizeof(cptr));
84 memcpy(&foo, &cfoo, sizeof(Foo));
86 memcpy(0, &arr, sizeof(arr));
88 memcpy(0, &arr, sizeof(Buff));
97 memset(&iarr[0], 0, sizeof iarr);
100 memset(&iparr[0], 0, sizeof iparr);
102 memset(m, 0, sizeof(Mat));
105 memcpy(&foo, &arr, sizeof(Foo));
106 memcpy(&arr, &foo, sizeof(Foo));
114 }), 0, sizeof(s));
120 memset(i, 0, sizeof(i));
134 strncmp(FOO, BAR, sizeof(FOO)); // \
136 strncasecmp(FOO, BAR, sizeof(FOO)); // \
141 strncpy(buff, BAR, sizeof(BAR)); // \
143 strndup(FOO, sizeof(FOO)); // \