xref: /llvm-project/compiler-rt/test/nsan/helpers.h (revision f4e8fbc5e90a4f2959a0eb6d7b01e7e279fb693b)
1*f4e8fbc5SAlexander Shaposhnikov // Prevents the compiler from optimizing everything away.
2*f4e8fbc5SAlexander Shaposhnikov template <class T> void DoNotOptimize(const T &var) {
3*f4e8fbc5SAlexander Shaposhnikov   asm volatile("" : "+m"(const_cast<T &>(var)));
4*f4e8fbc5SAlexander Shaposhnikov }
5