add some comments to MCSymbol header, make the ctor private so that only MCContext...
authorChris Lattner <sabre@nondot.org>
Wed, 1 Jul 2009 06:21:53 +0000 (06:21 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 1 Jul 2009 06:21:53 +0000 (06:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74590 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCSymbol.h

index 5f87f09694d89ed37d8534fdacbac84dbd5d2042..87698e364d3aed2cf015e3a3894e23aac63c24a8 100644 (file)
@@ -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
 
 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; }