From: Benjamin Kramer Date: Tue, 31 Oct 2017 19:22:55 +0000 (+0000) Subject: [coro] Make Spill a proper struct instead of deriving from pair. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aeaa65aec3fdd62da98a220195fa64c7ee81e86c;p=llvm [coro] Make Spill a proper struct instead of deriving from pair. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317027 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Coroutines/CoroFrame.cpp b/lib/Transforms/Coroutines/CoroFrame.cpp index d192fa699f3..6334256bf03 100644 --- a/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/lib/Transforms/Coroutines/CoroFrame.cpp @@ -261,21 +261,19 @@ SuspendCrossingInfo::SuspendCrossingInfo(Function &F, coro::Shape &Shape) // We build up the list of spills for every case where a use is separated // from the definition by a suspend point. -struct Spill : std::pair { - using base = std::pair; - - Spill(Value *Def, User *U) : base(Def, cast(U)) {} - - Value *def() const { return first; } - Instruction *user() const { return second; } - BasicBlock *userBlock() const { return second->getParent(); } +namespace { +class Spill { + Value *Def; + Instruction *User; - std::pair getKey() const { - return {def(), userBlock()}; - } +public: + Spill(Value *Def, llvm::User *U) : Def(Def), User(cast(U)) {} - bool operator<(Spill const &rhs) const { return getKey() < rhs.getKey(); } + Value *def() const { return Def; } + Instruction *user() const { return User; } + BasicBlock *userBlock() const { return User->getParent(); } }; +} // namespace // Note that there may be more than one record with the same value of Def in // the SpillInfo vector.