1 //===- MCSymbol.h - Machine Code Symbols ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declaration of the MCSymbol class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_MC_MCSYMBOL_H
15 #define LLVM_MC_MCSYMBOL_H
18 #include "llvm/ADT/StringRef.h"
24 /// MCSymbol - Instances of this class represent a symbol name in the MC file,
25 /// and MCSymbols are created and unique'd by the MCContext class.
27 /// If the symbol is defined/emitted into the current translation unit, the
28 /// Section member is set to indicate what section it lives in. Otherwise, if
29 /// it is a reference to an external entity, it has a null section.
32 /// Name - The name of the symbol.
34 /// Section - The section the symbol is defined in, or null if the symbol
35 /// has not been defined in the associated translation unit.
38 /// IsTemporary - True if this is an assembler temporary label, which
39 /// typically does not survive in the .o file's symbol table. Usually
41 unsigned IsTemporary : 1;
43 /// IsExternal - True if this symbol has been implicitly defined as an
44 /// external, for example by using it in an expression without ever emitting
45 /// it as a label. The @var Section for an external symbol is always null.
46 unsigned IsExternal : 1;
48 private: // MCContext creates and uniques these.
49 friend class MCContext;
50 MCSymbol(const StringRef &_Name, bool _IsTemporary)
51 : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {}
53 MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
54 void operator=(const MCSymbol&); // DO NOT IMPLEMENT
57 MCSection *getSection() const { return Section; }
58 void setSection(MCSection *Value) { Section = Value; }
60 bool isExternal() const { return IsExternal; }
61 void setExternal(bool Value) { IsExternal = Value; }
63 const std::string &getName() const { return Name; }
66 } // end namespace llvm