blob: 2a2b0b6fafad9d07e6dc45a41e1008d923c69dc9 [file] [log] [blame]
Chris Lattnered47a042009-07-31 17:02:00 +00001//===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/MC/MCSection.h"
11#include "llvm/MC/MCContext.h"
12using namespace llvm;
13
14MCSection::~MCSection() {
15}
16
17MCSection::MCSection(const StringRef &N, MCContext &Ctx) : Name(N) {
18 MCSection *&Entry = Ctx.Sections[Name];
19 assert(Entry == 0 && "Multiple sections with the same name created");
20 Entry = this;
21}
22
23MCSection *MCSection::Create(const StringRef &Name, MCContext &Ctx) {
24 return new (Ctx) MCSection(Name, Ctx);
25}
26
27
28MCSectionWithKind *
29MCSectionWithKind::Create(const StringRef &Name, SectionKind K, MCContext &Ctx){
30 return new (Ctx) MCSectionWithKind(Name, K, Ctx);
31}