mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test', so that running 'check-swift' will also run all the SourceKit tests. SourceKit is disabled on non-darwin platforms.
This commit is contained in:
12
tools/SourceKit/lib/Support/ThreadSafeRefCntPtr.cpp
Normal file
12
tools/SourceKit/lib/Support/ThreadSafeRefCntPtr.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "SourceKit/Support/ThreadSafeRefCntPtr.h"
|
||||
#include <functional>
|
||||
|
||||
using namespace SourceKit;
|
||||
using llvm::sys::Mutex;
|
||||
|
||||
static const size_t MtxCount = 16;
|
||||
static Mutex Mtxs[MtxCount];
|
||||
|
||||
Mutex *ThreadSafeRefCntPtrImpl::getMutex(void *Ptr) {
|
||||
return Mtxs + (std::hash<const void*>()(Ptr) & (MtxCount-1));
|
||||
}
|
||||
Reference in New Issue
Block a user