[libc++] Replace __sync_* functions with __libcpp_atomic_* functions

Summary:
This patch replaces __sync_* with __libcpp_atomic_* and adds a wrapper
function for __atomic_exchange to support _LIBCPP_HAS_NO_THREADS.

Reviewers: EricWF, jroelofs, mclow.lists, compnerd

Reviewed By: EricWF, compnerd

Subscribers: compnerd, efriedma, cfe-commits, joerg, llvm-commits

Differential Revision: https://reviews.llvm.org/D35235

llvm-svn: 313694
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: fbfaec7089b8bfc1e3ef91dfbc50b4b7cf7a79e7
diff --git a/src/exception.cpp b/src/exception.cpp
index 4359d12..3d2dcfd 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -31,6 +31,7 @@
 #include "support/runtime/exception_glibcxx.ipp"
 #include "support/runtime/exception_pointer_glibcxx.ipp"
 #else
+#include "include/atomic_support.h"
 #include "support/runtime/exception_fallback.ipp"
 #include "support/runtime/exception_pointer_unimplemented.ipp"
 #endif