#ifndef LLVM_MC_MCSECTIONMACHO_H
#define LLVM_MC_MCSECTIONMACHO_H
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSection.h"
#include "llvm/Support/MachO.h"
namespace llvm {
class MCSectionMachO final : public MCSection {
char SegmentName[16]; char SectionName[16];
unsigned TypeAndAttributes;
unsigned Reserved2;
MCSectionMachO(StringRef Segment, StringRef Section, unsigned TAA,
unsigned reserved2, SectionKind K, MCSymbol *Begin);
friend class MCContext;
public:
StringRef getSegmentName() const {
if (SegmentName[15])
return StringRef(SegmentName, 16);
return StringRef(SegmentName);
}
StringRef getSectionName() const {
if (SectionName[15])
return StringRef(SectionName, 16);
return StringRef(SectionName);
}
unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
unsigned getStubSize() const { return Reserved2; }
MachO::SectionType getType() const {
return static_cast<MachO::SectionType>(TypeAndAttributes &
MachO::SECTION_TYPE);
}
bool hasAttribute(unsigned Value) const {
return (TypeAndAttributes & Value) != 0;
}
static std::string ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize);
void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool isVirtualSection() const override;
static bool classof(const MCSection *S) {
return S->getVariant() == SV_MachO;
}
};
}
#endif