diff options
Diffstat (limited to 'lib/msan/tests/msandr_test_so.cc')
-rw-r--r-- | lib/msan/tests/msandr_test_so.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/msan/tests/msandr_test_so.cc b/lib/msan/tests/msandr_test_so.cc new file mode 100644 index 000000000000..fddd8ded8964 --- /dev/null +++ b/lib/msan/tests/msandr_test_so.cc @@ -0,0 +1,36 @@ +//===-- msandr_test_so.cc ------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is a part of MemorySanitizer. +// +// MemorySanitizer unit tests. +//===----------------------------------------------------------------------===// + +#include "msandr_test_so.h" + +void dso_memfill(char* s, unsigned n) { + for (unsigned i = 0; i < n; ++i) + s[i] = i; +} + +int dso_callfn(int (*fn)(void)) { + volatile int x = fn(); + return x; +} + +int dso_callfn1(int (*fn)(long long, long long, long long)) { //NOLINT + volatile int x = fn(1, 2, 3); + return x; +} + +int dso_stack_store(void (*fn)(int*, int*), int x) { + int y = x + 1; + fn(&x, &y); + return y; +} |