MCSection.cpp revision 4a7bc1e5aafbb543a9a535bce54fc62d18723b35
1//===- 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, SectionKind K, MCContext &Ctx)
18  : Name(N), Kind(K) {
19  MCSection *&Entry = Ctx.Sections[Name];
20  assert(Entry == 0 && "Multiple sections with the same name created");
21  Entry = this;
22}
23
24MCSection *MCSection::Create(const StringRef &Name, SectionKind K,
25                             MCContext &Ctx) {
26  return new (Ctx) MCSection(Name, K, Ctx);
27}
28
29