[llvm-commits] [compiler-rt] r168990 - in /compiler-rt/trunk/lib/asan/tests: CMakeLists.txt asan_break_optimization.cc asan_test_utils.h

Kostya Serebryany kcc at google.com
Fri Nov 30 01:52:44 PST 2012


Author: kcc
Date: Fri Nov 30 03:52:44 2012
New Revision: 168990

URL: http://llvm.org/viewvc/llvm-project?rev=168990&view=rev
Log:
[asan] simplify break_optimization in tests (Jakub Jelinek)

Removed:
    compiler-rt/trunk/lib/asan/tests/asan_break_optimization.cc
Modified:
    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/asan/tests/asan_test_utils.h

Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=168990&r1=168989&r2=168990&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Fri Nov 30 03:52:44 2012
@@ -105,7 +105,6 @@
 
 set(ASAN_NOINST_TEST_SOURCES
   asan_noinst_test.cc
-  asan_break_optimization.cc
   asan_test_main.cc
 )
 
@@ -147,8 +146,7 @@
   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.

Removed: compiler-rt/trunk/lib/asan/tests/asan_break_optimization.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_break_optimization.cc?rev=168989&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_break_optimization.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_break_optimization.cc (removed)
@@ -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;
-}

Modified: compiler-rt/trunk/lib/asan/tests/asan_test_utils.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test_utils.h?rev=168990&r1=168989&r2=168990&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test_utils.h (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test_utils.h Fri Nov 30 03:52:44 2012
@@ -53,8 +53,10 @@
 #  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.





More information about the llvm-commits mailing list