summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/warn-bad-memaccess.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-07-17 15:40:56 +0000
committerdim <dim@FreeBSD.org>2011-07-17 15:40:56 +0000
commit611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (patch)
tree2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/SemaCXX/warn-bad-memaccess.cpp
parentc49018d9cce52d8c9f34b44865ec3ba8e89a1488 (diff)
downloadFreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.zip
FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.tar.gz
Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
Diffstat (limited to 'test/SemaCXX/warn-bad-memaccess.cpp')
-rw-r--r--test/SemaCXX/warn-bad-memaccess.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-bad-memaccess.cpp b/test/SemaCXX/warn-bad-memaccess.cpp
index e7d095f..9a998f0 100644
--- a/test/SemaCXX/warn-bad-memaccess.cpp
+++ b/test/SemaCXX/warn-bad-memaccess.cpp
@@ -38,6 +38,46 @@ void test_warn() {
memcpy(0, &x1, sizeof x1); // \
// expected-warning{{source of this 'memcpy' call is a pointer to dynamic class}} \
// expected-note {{explicitly cast the pointer to silence this warning}}
+
+ __builtin_memset(&x1, 0, sizeof x1); // \
+ // expected-warning {{destination for this '__builtin_memset' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin_memset(&x2, 0, sizeof x2); // \
+ // expected-warning {{destination for this '__builtin_memset' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+
+ __builtin_memmove(&x1, 0, sizeof x1); // \
+ // expected-warning{{destination for this '__builtin_memmove' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin_memmove(0, &x1, sizeof x1); // \
+ // expected-warning{{source of this '__builtin_memmove' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin_memcpy(&x1, 0, sizeof x1); // \
+ // expected-warning{{destination for this '__builtin_memcpy' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin_memcpy(0, &x1, sizeof x1); // \
+ // expected-warning{{source of this '__builtin_memcpy' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+
+ __builtin___memset_chk(&x1, 0, sizeof x1, sizeof x1); // \
+ // expected-warning {{destination for this '__builtin___memset_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin___memset_chk(&x2, 0, sizeof x2, sizeof x2); // \
+ // expected-warning {{destination for this '__builtin___memset_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+
+ __builtin___memmove_chk(&x1, 0, sizeof x1, sizeof x1); // \
+ // expected-warning{{destination for this '__builtin___memmove_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin___memmove_chk(0, &x1, sizeof x1, sizeof x1); // \
+ // expected-warning{{source of this '__builtin___memmove_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin___memcpy_chk(&x1, 0, sizeof x1, sizeof x1); // \
+ // expected-warning{{destination for this '__builtin___memcpy_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ __builtin___memcpy_chk(0, &x1, sizeof x1, sizeof x1); // \
+ // expected-warning{{source of this '__builtin___memcpy_chk' call is a pointer to dynamic class}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
}
void test_nowarn(void *void_ptr) {
@@ -68,3 +108,5 @@ namespace N {
N::memset(&x1, 0, sizeof x1);
}
}
+
+
OpenPOWER on IntegriCloud