1 //===- MCLabel.h - Machine Code Directional Local Labels --------*- C++ -*-===//
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 // This file contains the declaration of the MCLabel class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_MC_MCLABEL_H
14 #define LLVM_MC_MCLABEL_H
20 /// Instances of this class represent a label name in the MC file,
21 /// and MCLabel are created and uniqued by the MCContext class. MCLabel
22 /// should only be constructed for valid instances in the object file.
24 // The instance number of this Directional Local Label.
27 private: // MCContext creates and uniques these.
28 friend class MCContext
;
30 MCLabel(unsigned instance
) : Instance(instance
) {}
33 MCLabel(const MCLabel
&) = delete;
34 MCLabel
&operator=(const MCLabel
&) = delete;
36 /// Get the current instance of this Directional Local Label.
37 unsigned getInstance() const { return Instance
; }
39 /// Increment the current instance of this Directional Local Label.
40 unsigned incInstance() { return ++Instance
; }
42 /// Print the value to the stream \p OS.
43 void print(raw_ostream
&OS
) const;
45 /// Print the value to stderr.
49 inline raw_ostream
&operator<<(raw_ostream
&OS
, const MCLabel
&Label
) {
54 } // end namespace llvm
56 #endif // LLVM_MC_MCLABEL_H