[llvm-commits] [llvm] r78870 - in /llvm/trunk: include/llvm/MC/MCContext.h lib/MC/MCContext.cpp lib/Target/TargetLoweringObjectFile.cpp

Chris Lattner sabre at nondot.org
Wed Aug 12 17:21:54 PDT 2009


Author: lattner
Date: Wed Aug 12 19:21:53 2009
New Revision: 78870

URL: http://llvm.org/viewvc/llvm-project?rev=78870&view=rev
Log:
add some comments: MCContext owns the MCSections, but it bump pointer allocates
them, so it doesn't have to explicitly free them.

Modified:
    llvm/trunk/include/llvm/MC/MCContext.h
    llvm/trunk/lib/MC/MCContext.cpp
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp

Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=78870&r1=78869&r2=78870&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Wed Aug 12 19:21:53 2009
@@ -20,7 +20,9 @@
   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 @@
     /// 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");

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=78870&r1=78869&r2=78870&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Wed Aug 12 19:21:53 2009
@@ -18,6 +18,8 @@
 }
 
 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 {

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=78870&r1=78869&r2=78870&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Aug 12 19:21:53 2009
@@ -708,8 +708,6 @@
                       " section specifier");
   }
   
-  
-  
   return S;
 }
 





More information about the llvm-commits mailing list