forked from OSchip/llvm-project
[asan] simplify break_optimization in tests (Jakub Jelinek)
llvm-svn: 168990
This commit is contained in:
parent
d9ef81e133
commit
6a786e66cf
|
@ -105,7 +105,6 @@ endfunction()
|
|||
|
||||
set(ASAN_NOINST_TEST_SOURCES
|
||||
asan_noinst_test.cc
|
||||
asan_break_optimization.cc
|
||||
asan_test_main.cc
|
||||
)
|
||||
|
||||
|
@ -147,8 +146,7 @@ if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX AND NOT ANDROID)
|
|||
add_asan_compile_command(asan_benchmarks_test.cc "")
|
||||
add_custom_target(AsanBenchmarks)
|
||||
set_target_properties(AsanBenchmarks PROPERTIES FOLDER "Asan benchmarks")
|
||||
add_asan_test(AsanBenchmarks AsanBenchmark asan_break_optimization.cc
|
||||
asan_benchmarks_test.cc.asan.o)
|
||||
add_asan_test(AsanBenchmarks AsanBenchmark asan_benchmarks_test.cc.asan.o)
|
||||
endif()
|
||||
|
||||
# Main AddressSanitizer unit tests.
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
//===-- asan_break_optimization.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 AddressSanitizer, an address sanity checker.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "asan_test_utils.h"
|
||||
// Have this function in a separate file to avoid inlining.
|
||||
// (Yes, we know about cross-file inlining, but let's assume we don't use it).
|
||||
extern "C" void break_optimization(void *x) {
|
||||
(void)x;
|
||||
}
|
|
@ -53,8 +53,10 @@ typedef __int64 int64_t;
|
|||
# define SANITIZER_WORDSIZE 32
|
||||
#endif
|
||||
|
||||
// Make the compiler think that something is going on there.
|
||||
extern "C" void break_optimization(void *arg);
|
||||
// Make the compiler thinks that something is going on there.
|
||||
inline void break_optimization(void *arg) {
|
||||
__asm__ __volatile__ ("" : : "r" (arg) : "memory");
|
||||
}
|
||||
|
||||
// This function returns its parameter but in such a way that compiler
|
||||
// can not prove it.
|
||||
|
|
Loading…
Reference in New Issue