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 {
|
||||
friend class SymbolStringPtr;
|
||||
public:
|
||||
/// @brief Destroy a SymbolStringPool.
|
||||
~SymbolStringPool();
|
||||
|
||||
/// @brief Create a symbol string pointer from the given string.
|
||||
SymbolStringPtr intern(StringRef S);
|
||||
|
||||
|
@ -109,6 +112,13 @@ inline bool operator<(const SymbolStringPtr &LHS, const SymbolStringPtr &RHS) {
|
|||
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) {
|
||||
std::lock_guard<std::mutex> Lock(PoolMutex);
|
||||
PoolMap::iterator I;
|
||||
|
|
Loading…
Reference in New Issue