forked from OSchip/llvm-project
types don't need atomic inc/dec, they are local to an llvmcontext.
llvm-svn: 91873
This commit is contained in:
parent
f376c40d0e
commit
18d8b7575e
|
@ -7,14 +7,12 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
||||||
#ifndef LLVM_TYPE_H
|
#ifndef LLVM_TYPE_H
|
||||||
#define LLVM_TYPE_H
|
#define LLVM_TYPE_H
|
||||||
|
|
||||||
#include "llvm/AbstractTypeUser.h"
|
#include "llvm/AbstractTypeUser.h"
|
||||||
#include "llvm/Support/Casting.h"
|
#include "llvm/Support/Casting.h"
|
||||||
#include "llvm/System/DataTypes.h"
|
#include "llvm/System/DataTypes.h"
|
||||||
#include "llvm/System/Atomic.h"
|
|
||||||
#include "llvm/ADT/GraphTraits.h"
|
#include "llvm/ADT/GraphTraits.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -104,7 +102,7 @@ private:
|
||||||
/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
|
/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
|
||||||
/// derived types.
|
/// derived types.
|
||||||
///
|
///
|
||||||
mutable sys::cas_flag RefCount;
|
mutable unsigned RefCount;
|
||||||
|
|
||||||
/// Context - This refers to the LLVMContext in which this type was uniqued.
|
/// Context - This refers to the LLVMContext in which this type was uniqued.
|
||||||
LLVMContext &Context;
|
LLVMContext &Context;
|
||||||
|
@ -401,7 +399,7 @@ public:
|
||||||
|
|
||||||
void addRef() const {
|
void addRef() const {
|
||||||
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
|
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
|
||||||
sys::AtomicIncrement(&RefCount);
|
++RefCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dropRef() const {
|
void dropRef() const {
|
||||||
|
@ -410,8 +408,7 @@ public:
|
||||||
|
|
||||||
// If this is the last PATypeHolder using this object, and there are no
|
// If this is the last PATypeHolder using this object, and there are no
|
||||||
// PATypeHandles using it, the type is dead, delete it now.
|
// PATypeHandles using it, the type is dead, delete it now.
|
||||||
sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount);
|
if (RefCount-- == 0 && AbstractTypeUsers.empty())
|
||||||
if (OldCount == 0 && AbstractTypeUsers.empty())
|
|
||||||
this->destroy();
|
this->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue