asan_test_utils.h revision 1e172b4bdec57329bf904f063a29f99cddf2d85f
1//===-- asan_test_utils.h ------------*- C++ -*-===// 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 AddressSanitizer, an address sanity checker. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef ASAN_TEST_UTILS_H 15#define ASAN_TEST_UTILS_H 16 17// Make the compiler think that something is going on there. 18extern "C" void break_optimization(void *); 19 20// This function returns its parameter but in such a way that compiler 21// can not prove it. 22template<class T> 23__attribute__((noinline)) 24static T Ident(T t) { 25 T ret = t; 26 break_optimization(&ret); 27 return ret; 28} 29 30#endif // ASAN_TEST_UTILS_H 31