forked from OSchip/llvm-project
[ORC] Add a debugging check to catch dangling references to SymbolStringPools.
llvm-svn: 329019
This commit is contained in:
parent
e8f12eb952
commit
a82c25a434
|
@ -27,6 +27,9 @@ class SymbolStringPtr;
|
||||||
class SymbolStringPool {
|
class SymbolStringPool {
|
||||||
friend class SymbolStringPtr;
|
friend class SymbolStringPtr;
|
||||||
public:
|
public:
|
||||||
|
/// @brief Destroy a SymbolStringPool.
|
||||||
|
~SymbolStringPool();
|
||||||
|
|
||||||
/// @brief Create a symbol string pointer from the given string.
|
/// @brief Create a symbol string pointer from the given string.
|
||||||
SymbolStringPtr intern(StringRef S);
|
SymbolStringPtr intern(StringRef S);
|
||||||
|
|
||||||
|
@ -109,6 +112,13 @@ inline bool operator<(const SymbolStringPtr &LHS, const SymbolStringPtr &RHS) {
|
||||||
return LHS.S < RHS.S;
|
return LHS.S < RHS.S;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline SymbolStringPool::~SymbolStringPool() {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
clearDeadEntries();
|
||||||
|
assert(Pool.empty() && "Dangling references at pool destruction time");
|
||||||
|
#endif // NDEBUG
|
||||||
|
}
|
||||||
|
|
||||||
inline SymbolStringPtr SymbolStringPool::intern(StringRef S) {
|
inline SymbolStringPtr SymbolStringPool::intern(StringRef S) {
|
||||||
std::lock_guard<std::mutex> Lock(PoolMutex);
|
std::lock_guard<std::mutex> Lock(PoolMutex);
|
||||||
PoolMap::iterator I;
|
PoolMap::iterator I;
|
||||||
|
|
Loading…
Reference in New Issue