add some comments: MCContext owns the MCSections, but it bump pointer allocates
authorChris Lattner <sabre@nondot.org>
Thu, 13 Aug 2009 00:21:53 +0000 (00:21 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Aug 2009 00:21:53 +0000 (00:21 +0000)
them, so it doesn't have to explicitly free them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78870 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCContext.h
lib/MC/MCContext.cpp
lib/Target/TargetLoweringObjectFile.cpp

index f0f5e155553712d82953229c66136a39002b347d..adf380472a13a14afd89fe167462bea7636e504c 100644 (file)
@@ -20,7 +20,9 @@ namespace llvm {
   class MCSymbol;
   class StringRef;
 
-  /// MCContext - Context object for machine code objects.
+  /// MCContext - Context object for machine code objects.  This class owns all
+  /// of the sections that it creates.
+  ///
   class MCContext {
     MCContext(const MCContext&); // DO NOT IMPLEMENT
     MCContext &operator=(const MCContext&); // DO NOT IMPLEMENT
@@ -49,7 +51,6 @@ namespace llvm {
     /// null if it doesn't exist.
     MCSection *GetSection(const StringRef &Name) const;
     
-    
     void SetSection(const StringRef &Name, MCSection *S) {
       MCSection *&Entry = Sections[Name];
       assert(Entry == 0 && "Multiple sections with the same name created");
index e6fb5c8809ba7853408d74643e2bdfe164a4353f..63338353a1f71c42f287814f0754866db11c47f0 100644 (file)
@@ -18,6 +18,8 @@ MCContext::MCContext() {
 }
 
 MCContext::~MCContext() {
+  // NOTE: The sections are all allocated out of a bump pointer allocator,
+  // we don't need to free them here.
 }
 
 MCSection *MCContext::GetSection(const StringRef &Name) const {
index 094e837f6f9a118dbb642b56342cae604484d318..e7680c8a877442dc9e023a71ad388e224869dd19 100644 (file)
@@ -708,8 +708,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
                       " section specifier");
   }
   
-  
-  
   return S;
 }