From: Chris Lattner Date: Wed, 1 Jul 2009 06:21:53 +0000 (+0000) Subject: add some comments to MCSymbol header, make the ctor private so that only MCContext... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=14022f2a5a51d8ac0d8066a87dfd2dc2f2fabfdf;p=oota-llvm.git add some comments to MCSymbol header, make the ctor private so that only MCContext can create these. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74590 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index 5f87f09694d..87698e364d3 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -6,6 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// This file contains the declaration of the MCSymbol class. +// +//===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCSYMBOL_H #define LLVM_MC_MCSYMBOL_H @@ -14,17 +18,36 @@ namespace llvm { class MCSection; - + class MCContext; + + /// MCSymbol - Instances of this class represent a symbol name in the MC file, + /// and MCSymbols are created and unique'd by the MCContext class. + /// + /// If the symbol is defined/emitted into the current translation unit, the + /// Section member is set to indicate what section it lives in. Otherwise, if + /// it is a reference to an external entity, it has a null section. + /// class MCSymbol { - MCSection *Section; + /// Name - The name of the symbol. std::string Name; + /// Section - The section the symbol is defined in, or null if not defined + /// in this translation unit. + MCSection *Section; + + /// IsTemporary - True if this is an assembler temporary label, which + /// typically does not survive in the .o file's symbol table. Usually + /// "Lfoo" or ".foo". unsigned IsTemporary : 1; + + /// IsExternal - ? unsigned IsExternal : 1; - public: + private: // MCContext creates and uniques these. + friend class MCContext; MCSymbol(const char *_Name, bool _IsTemporary) - : Section(0), Name(_Name), IsTemporary(_IsTemporary), IsExternal(false) {} - + : Name(_Name), Section(0), IsTemporary(_IsTemporary), IsExternal(false) {} + public: + MCSection *getSection() const { return Section; } void setSection(MCSection *Value) { Section = Value; }