Home | History | Annotate | Download | only in tests
      1 //===-- msandr_test_so.cc  ------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file is a part of MemorySanitizer.
     11 //
     12 // MemorySanitizer unit tests.
     13 //===----------------------------------------------------------------------===//
     14 
     15 #include "msandr_test_so.h"
     16 
     17 void dso_memfill(char* s, unsigned n) {
     18   for (unsigned i = 0; i < n; ++i)
     19     s[i] = i;
     20 }
     21 
     22 int dso_callfn(int (*fn)(void)) {
     23   volatile int x = fn();
     24   return x;
     25 }
     26 
     27 int dso_callfn1(int (*fn)(long long, long long, long long)) {  //NOLINT
     28   volatile int x = fn(1, 2, 3);
     29   return x;
     30 }
     31 
     32 int dso_stack_store(void (*fn)(int*, int*), int x) {
     33   int y = x + 1;
     34   fn(&x, &y);
     35   return y;
     36 }
     37 
     38 void break_optimization(void *x) {}
     39