1 //===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCSection.h"
11 #include "llvm/MC/MCContext.h"
12 #include "llvm/MC/MCAsmInfo.h"
13 #include "llvm/Support/raw_ostream.h"
16 //===----------------------------------------------------------------------===//
18 //===----------------------------------------------------------------------===//
20 MCSection::~MCSection() {
23 //===----------------------------------------------------------------------===//
25 //===----------------------------------------------------------------------===//
27 MCSectionCOFF *MCSectionCOFF::
28 Create(StringRef Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
29 char *NameCopy = static_cast<char*>(
30 Ctx.Allocate(Name.size(), /*Alignment=*/1));
31 memcpy(NameCopy, Name.data(), Name.size());
32 return new (Ctx) MCSectionCOFF(StringRef(NameCopy, Name.size()),
36 void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
37 raw_ostream &OS) const {
40 OS << getName() << '\n';
43 OS << "\t.section\t" << getName() << ",\"";
44 if (getKind().isText())
46 if (getKind().isWriteable())