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
/// 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");
}
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 {