The Windows build is just too weird; there's no real cost to doing the concurrency checks for ASTUnit in all builds
llvm-svn: 97840
This commit is contained in:
parent
2664d295cb
commit
7829362620
|
@ -89,7 +89,6 @@ class ASTUnit {
|
||||||
/// destroyed.
|
/// destroyed.
|
||||||
llvm::SmallVector<llvm::sys::Path, 4> TemporaryFiles;
|
llvm::SmallVector<llvm::sys::Path, 4> TemporaryFiles;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
/// \brief Simple hack to allow us to assert that ASTUnit is not being
|
/// \brief Simple hack to allow us to assert that ASTUnit is not being
|
||||||
/// used concurrently, which is not supported.
|
/// used concurrently, which is not supported.
|
||||||
///
|
///
|
||||||
|
@ -99,35 +98,26 @@ class ASTUnit {
|
||||||
unsigned int ConcurrencyCheckValue;
|
unsigned int ConcurrencyCheckValue;
|
||||||
static const unsigned int CheckLocked = 28573289;
|
static const unsigned int CheckLocked = 28573289;
|
||||||
static const unsigned int CheckUnlocked = 9803453;
|
static const unsigned int CheckUnlocked = 9803453;
|
||||||
#endif
|
|
||||||
|
|
||||||
ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
|
ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
|
||||||
ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
|
ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class ConcurrencyCheck {
|
class ConcurrencyCheck {
|
||||||
#ifdef _DEBUG
|
|
||||||
volatile ASTUnit &Self;
|
volatile ASTUnit &Self;
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConcurrencyCheck(ASTUnit &Self)
|
explicit ConcurrencyCheck(ASTUnit &Self)
|
||||||
#ifdef _DEBUG
|
|
||||||
: Self(Self)
|
: Self(Self)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
assert(Self.ConcurrencyCheckValue == CheckUnlocked &&
|
assert(Self.ConcurrencyCheckValue == CheckUnlocked &&
|
||||||
"Concurrent access to ASTUnit!");
|
"Concurrent access to ASTUnit!");
|
||||||
Self.ConcurrencyCheckValue = CheckLocked;
|
Self.ConcurrencyCheckValue = CheckLocked;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
~ConcurrencyCheck() {
|
~ConcurrencyCheck() {
|
||||||
Self.ConcurrencyCheckValue = CheckUnlocked;
|
Self.ConcurrencyCheckValue = CheckUnlocked;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
friend class ConcurrencyCheck;
|
friend class ConcurrencyCheck;
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,7 @@ ASTUnit::ASTUnit(bool _MainFileIsAST)
|
||||||
: MainFileIsAST(_MainFileIsAST), ConcurrencyCheckValue(CheckUnlocked) {
|
: MainFileIsAST(_MainFileIsAST), ConcurrencyCheckValue(CheckUnlocked) {
|
||||||
}
|
}
|
||||||
ASTUnit::~ASTUnit() {
|
ASTUnit::~ASTUnit() {
|
||||||
#ifdef _DEBUG
|
|
||||||
ConcurrencyCheckValue = CheckLocked;
|
ConcurrencyCheckValue = CheckLocked;
|
||||||
#endif
|
|
||||||
for (unsigned I = 0, N = TemporaryFiles.size(); I != N; ++I)
|
for (unsigned I = 0, N = TemporaryFiles.size(); I != N; ++I)
|
||||||
TemporaryFiles[I].eraseFromDisk();
|
TemporaryFiles[I].eraseFromDisk();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue