1 //===-- Use.cpp - Implement the Use class ---------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/IR/Use.h"
10 #include "llvm/IR/User.h"
11 #include "llvm/IR/Value.h"
16 void Use::swap(Use
&RHS
) {
20 std::swap(Val
, RHS
.Val
);
21 std::swap(Next
, RHS
.Next
);
22 std::swap(Prev
, RHS
.Prev
);
30 RHS
.Next
->Prev
= &RHS
.Next
;
33 unsigned Use::getOperandNo() const {
34 return this - getUser()->op_begin();
37 void Use::zap(Use
*Start
, const Use
*Stop
, bool del
) {
41 ::operator delete(Start
);