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
23 /// MCSymbol - Instances of this class represent a symbol name in the MC file,
24 /// and MCSymbols are created and unique'd by the MCContext class.
26 /// If the symbol is defined/emitted into the current translation unit, the
27 /// Section member is set to indicate what section it lives in. Otherwise, if
28 /// it is a reference to an external entity, it has a null section.
31 /// Name - The name of the symbol.
33 /// Section - The section the symbol is defined in, or null if the symbol
34 /// has not been defined in the associated translation unit.
37 /// IsTemporary - True if this is an assembler temporary label, which
38 /// typically does not survive in the .o file's symbol table. Usually
40 unsigned IsTemporary : 1;
42 /// IsExternal - True if this symbol has been implicitly defined as an
43 /// external, for example by using it in an expression without ever emitting
44 /// it as a label. The @var Section for an external symbol is always null.
45 unsigned IsExternal : 1;
47 private: // MCContext creates and uniques these.
48 friend class MCContext;
49 MCSymbol(const char *_Name, bool _IsTemporary)
50 : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {}
52 MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
53 void operator=(const MCSymbol&); // DO NOT IMPLEMENT
56 MCSection *getSection() const { return Section; }
57 void setSection(MCSection *Value) { Section = Value; }
59 bool isExternal() const { return IsExternal; }
60 void setExternal(bool Value) { IsExternal = Value; }
62 const std::string &getName() const { return Name; }
65 } // end namespace llvm