forked from OSchip/llvm-project
Move VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtr
llvm-svn: 291156
This commit is contained in:
parent
95dd362c77
commit
feaf9d1463
|
@ -119,7 +119,7 @@ class VariantMatcher {
|
|||
/// \brief Payload interface to be specialized by each matcher type.
|
||||
///
|
||||
/// It follows a similar interface as VariantMatcher itself.
|
||||
class Payload : public RefCountedBase<Payload> {
|
||||
class Payload {
|
||||
public:
|
||||
virtual ~Payload();
|
||||
virtual llvm::Optional<DynTypedMatcher> getSingleMatcher() const = 0;
|
||||
|
@ -208,7 +208,8 @@ public:
|
|||
std::string getTypeAsString() const;
|
||||
|
||||
private:
|
||||
explicit VariantMatcher(Payload *Value) : Value(Value) {}
|
||||
explicit VariantMatcher(std::shared_ptr<Payload> Value)
|
||||
: Value(std::move(Value)) {}
|
||||
|
||||
template <typename T> struct TypedMatcherOps;
|
||||
|
||||
|
@ -216,7 +217,7 @@ private:
|
|||
class PolymorphicPayload;
|
||||
class VariadicOpPayload;
|
||||
|
||||
IntrusiveRefCntPtr<const Payload> Value;
|
||||
std::shared_ptr<const Payload> Value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -216,18 +216,20 @@ private:
|
|||
VariantMatcher::VariantMatcher() {}
|
||||
|
||||
VariantMatcher VariantMatcher::SingleMatcher(const DynTypedMatcher &Matcher) {
|
||||
return VariantMatcher(new SinglePayload(Matcher));
|
||||
return VariantMatcher(std::make_shared<SinglePayload>(Matcher));
|
||||
}
|
||||
|
||||
VariantMatcher
|
||||
VariantMatcher::PolymorphicMatcher(std::vector<DynTypedMatcher> Matchers) {
|
||||
return VariantMatcher(new PolymorphicPayload(std::move(Matchers)));
|
||||
return VariantMatcher(
|
||||
std::make_shared<PolymorphicPayload>(std::move(Matchers)));
|
||||
}
|
||||
|
||||
VariantMatcher VariantMatcher::VariadicOperatorMatcher(
|
||||
DynTypedMatcher::VariadicOperator Op,
|
||||
std::vector<VariantMatcher> Args) {
|
||||
return VariantMatcher(new VariadicOpPayload(Op, std::move(Args)));
|
||||
return VariantMatcher(
|
||||
std::make_shared<VariadicOpPayload>(Op, std::move(Args)));
|
||||
}
|
||||
|
||||
llvm::Optional<DynTypedMatcher> VariantMatcher::getSingleMatcher() const {
|
||||
|
|
Loading…
Reference in New Issue