aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VMCore/Attributes.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 477111a3ae..e4a228b8c6 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -106,6 +106,11 @@ Attributes Attribute::typeIncompatible(const Type *Ty) {
// AttributeListImpl Definition
//===----------------------------------------------------------------------===//
+namespace llvm {
+ class AttributeListImpl;
+}
+
+static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
namespace llvm {
static ManagedStatic<sys::SmartMutex<true> > ALMutex;
@@ -131,6 +136,8 @@ public:
}
void DropRef() {
sys::SmartScopedLock<true> Lock(*ALMutex);
+ if (!AttributesLists.isConstructed())
+ return;
sys::cas_flag new_val = --RefCount;
if (new_val == 0)
delete this;
@@ -147,8 +154,6 @@ public:
};
}
-static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
-
AttributeListImpl::~AttributeListImpl() {
// NOTE: Lock must be acquired by caller.
AttributesLists->RemoveNode(this);