[llvm-commits] [compiler-rt] r147919 - in /compiler-rt/trunk/lib/asan: asan_internal.h asan_posix.cc

Kostya Serebryany kcc at google.com
Tue Jan 10 18:39:16 PST 2012


Author: kcc
Date: Tue Jan 10 20:39:16 2012
New Revision: 147919

URL: http://llvm.org/viewvc/llvm-project?rev=147919&view=rev
Log:
[asan] remove OS-dependent headers from asan_internal.h

Modified:
    compiler-rt/trunk/lib/asan/asan_internal.h
    compiler-rt/trunk/lib/asan/asan_posix.cc

Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=147919&r1=147918&r2=147919&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Tue Jan 10 20:39:16 2012
@@ -31,10 +31,6 @@
 #endif
 #endif
 
-#ifdef ANDROID
-#include <sys/atomics.h>
-#endif
-
 #if defined(__has_feature) && __has_feature(address_sanitizer)
 # error "The AddressSanitizer run-time should not be"
         " instrumented by AddressSanitizer"
@@ -109,6 +105,7 @@
 void InstallSignalHandlers();
 int GetPid();
 uintptr_t GetThreadSelf();
+int AtomicInc(int *a);
 
 // Wrapper for TLS/TSD.
 void AsanTSDInit();
@@ -240,23 +237,6 @@
   char *allocated_current_;
 };
 
-// -------------------------- Atomic ---------------- {{{1
-static inline int AtomicInc(int *a) {
-#ifdef ANDROID
-  return __atomic_inc(a) + 1;
-#else
-  return __sync_add_and_fetch(a, 1);
-#endif
-}
-
-static inline int AtomicDec(int *a) {
-#ifdef ANDROID
-  return __atomic_dec(a) - 1;
-#else
-  return __sync_add_and_fetch(a, -1);
-#endif
-}
-
 }  // namespace __asan
 
 #endif  // ASAN_INTERNAL_H

Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=147919&r1=147918&r2=147919&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_posix.cc Tue Jan 10 20:39:16 2012
@@ -24,6 +24,10 @@
 #include <sys/resource.h>
 #include <unistd.h>
 
+#ifdef ANDROID
+#include <sys/atomics.h>
+#endif
+
 namespace __asan {
 
 static void MaybeInstallSigaction(int signum,
@@ -77,6 +81,14 @@
   return (uintptr_t)pthread_self();
 }
 
+int AtomicInc(int *a) {
+#ifdef ANDROID
+  return __atomic_inc(a) + 1;
+#else
+  return __sync_add_and_fetch(a, 1);
+#endif
+}
+
 // ---------------------- TSD ---------------- {{{1
 
 static pthread_key_t tsd_key;





More information about the llvm-commits mailing list