Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- DarwinAsmParser.cpp - Darwin (Mach-O) Assembly Parser --------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "llvm/ADT/STLExtras.h"
10
#include "llvm/ADT/SmallVector.h"
11
#include "llvm/ADT/StringRef.h"
12
#include "llvm/ADT/StringSwitch.h"
13
#include "llvm/ADT/Triple.h"
14
#include "llvm/ADT/Twine.h"
15
#include "llvm/BinaryFormat/MachO.h"
16
#include "llvm/MC/MCContext.h"
17
#include "llvm/MC/MCDirectives.h"
18
#include "llvm/MC/MCObjectFileInfo.h"
19
#include "llvm/MC/MCParser/MCAsmLexer.h"
20
#include "llvm/MC/MCParser/MCAsmParser.h"
21
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
22
#include "llvm/MC/MCSectionMachO.h"
23
#include "llvm/MC/MCStreamer.h"
24
#include "llvm/MC/MCSymbol.h"
25
#include "llvm/MC/SectionKind.h"
26
#include "llvm/Support/FileSystem.h"
27
#include "llvm/Support/MemoryBuffer.h"
28
#include "llvm/Support/SMLoc.h"
29
#include "llvm/Support/SourceMgr.h"
30
#include "llvm/Support/raw_ostream.h"
31
#include <algorithm>
32
#include <cstddef>
33
#include <cstdint>
34
#include <string>
35
#include <system_error>
36
#include <utility>
37
38
using namespace llvm;
39
40
namespace {
41
42
/// Implementation of directive handling which is shared across all
43
/// Darwin targets.
44
class DarwinAsmParser : public MCAsmParserExtension {
45
  template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)>
46
362k
  void addDirectiveHandler(StringRef Directive) {
47
362k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
362k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
362k
    getParser().addDirectiveHandler(Directive, Handler);
50
362k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveAltEntry(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveDesc(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveIndirectSymbol(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveLsym(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveSubsectionsViaSymbols(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveDumpOrLoad(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
10.5k
  void addDirectiveHandler(StringRef Directive) {
47
10.5k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
10.5k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
10.5k
    getParser().addDirectiveHandler(Directive, Handler);
50
10.5k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveSection(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectivePushSection(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectivePopSection(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectivePrevious(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveSecureLogUnique(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveSecureLogReset(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveTBSS(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveZerofill(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveDataRegion(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveDataRegionEnd(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveBss(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConst(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConstData(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConstructor(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveCString(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveData(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveDestructor(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveDyld(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveFVMLibInit0(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveFVMLibInit1(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLazySymbolPointers(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseDirectiveLinkerOption(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral16(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral4(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral8(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveModInitFunc(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveModTermFunc(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveNonLazySymbolPointers(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveThreadLocalVariablePointers(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCatClsMeth(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCatInstMeth(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCategory(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClass(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClassNames(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClassVars(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClsMeth(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClsRefs(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCInstMeth(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCInstanceVars(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMessageRefs(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMetaClass(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMethVarNames(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMethVarTypes(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCModuleInfo(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCProtocol(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCSelectorStrs(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCStringObject(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCSymbols(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectivePICSymbolStub(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveStaticConst(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveStaticData(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveSymbolStub(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveTData(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveText(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveThreadInitFunc(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveTLV(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseSectionDirectiveIdent(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseWatchOSVersionMin(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseTvOSVersionMin(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseIOSVersionMin(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseMacOSXVersionMin(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&((anonymous namespace)::DarwinAsmParser::parseBuildVersion(llvm::StringRef, llvm::SMLoc))>(llvm::StringRef)
Line
Count
Source
46
5.25k
  void addDirectiveHandler(StringRef Directive) {
47
5.25k
    MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
48
5.25k
        this, HandleDirective<DarwinAsmParser, HandlerMethod>);
49
5.25k
    getParser().addDirectiveHandler(Directive, Handler);
50
5.25k
  }
51
52
  bool parseSectionSwitch(StringRef Segment, StringRef Section,
53
                          unsigned TAA = 0, unsigned ImplicitAlign = 0,
54
                          unsigned StubSize = 0);
55
56
  SMLoc LastVersionDirective;
57
58
public:
59
5.25k
  DarwinAsmParser() = default;
60
61
5.25k
  void Initialize(MCAsmParser &Parser) override {
62
5.25k
    // Call the base implementation.
63
5.25k
    this->MCAsmParserExtension::Initialize(Parser);
64
5.25k
65
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveAltEntry>(".alt_entry");
66
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveDesc>(".desc");
67
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveIndirectSymbol>(
68
5.25k
      ".indirect_symbol");
69
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveLsym>(".lsym");
70
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveSubsectionsViaSymbols>(
71
5.25k
      ".subsections_via_symbols");
72
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveDumpOrLoad>(".dump");
73
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveDumpOrLoad>(".load");
74
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveSection>(".section");
75
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectivePushSection>(
76
5.25k
      ".pushsection");
77
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectivePopSection>(
78
5.25k
      ".popsection");
79
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectivePrevious>(".previous");
80
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveSecureLogUnique>(
81
5.25k
      ".secure_log_unique");
82
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveSecureLogReset>(
83
5.25k
      ".secure_log_reset");
84
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveTBSS>(".tbss");
85
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveZerofill>(".zerofill");
86
5.25k
87
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveDataRegion>(
88
5.25k
      ".data_region");
89
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveDataRegionEnd>(
90
5.25k
      ".end_data_region");
91
5.25k
92
5.25k
    // Special section directives.
93
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveBss>(".bss");
94
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConst>(".const");
95
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConstData>(
96
5.25k
      ".const_data");
97
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConstructor>(
98
5.25k
      ".constructor");
99
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveCString>(
100
5.25k
      ".cstring");
101
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveData>(".data");
102
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveDestructor>(
103
5.25k
      ".destructor");
104
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveDyld>(".dyld");
105
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveFVMLibInit0>(
106
5.25k
      ".fvmlib_init0");
107
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveFVMLibInit1>(
108
5.25k
      ".fvmlib_init1");
109
5.25k
    addDirectiveHandler<
110
5.25k
      &DarwinAsmParser::parseSectionDirectiveLazySymbolPointers>(
111
5.25k
        ".lazy_symbol_pointer");
112
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseDirectiveLinkerOption>(
113
5.25k
      ".linker_option");
114
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral16>(
115
5.25k
      ".literal16");
116
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral4>(
117
5.25k
      ".literal4");
118
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral8>(
119
5.25k
      ".literal8");
120
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveModInitFunc>(
121
5.25k
      ".mod_init_func");
122
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveModTermFunc>(
123
5.25k
      ".mod_term_func");
124
5.25k
    addDirectiveHandler<
125
5.25k
      &DarwinAsmParser::parseSectionDirectiveNonLazySymbolPointers>(
126
5.25k
        ".non_lazy_symbol_pointer");
127
5.25k
    addDirectiveHandler<
128
5.25k
      &DarwinAsmParser::parseSectionDirectiveThreadLocalVariablePointers>(
129
5.25k
        ".thread_local_variable_pointer");
130
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCatClsMeth>(
131
5.25k
      ".objc_cat_cls_meth");
132
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCatInstMeth>(
133
5.25k
      ".objc_cat_inst_meth");
134
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCategory>(
135
5.25k
      ".objc_category");
136
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClass>(
137
5.25k
      ".objc_class");
138
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClassNames>(
139
5.25k
      ".objc_class_names");
140
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClassVars>(
141
5.25k
      ".objc_class_vars");
142
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClsMeth>(
143
5.25k
      ".objc_cls_meth");
144
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClsRefs>(
145
5.25k
      ".objc_cls_refs");
146
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCInstMeth>(
147
5.25k
      ".objc_inst_meth");
148
5.25k
    addDirectiveHandler<
149
5.25k
      &DarwinAsmParser::parseSectionDirectiveObjCInstanceVars>(
150
5.25k
        ".objc_instance_vars");
151
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCMessageRefs>(
152
5.25k
      ".objc_message_refs");
153
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCMetaClass>(
154
5.25k
      ".objc_meta_class");
155
5.25k
    addDirectiveHandler<
156
5.25k
      &DarwinAsmParser::parseSectionDirectiveObjCMethVarNames>(
157
5.25k
        ".objc_meth_var_names");
158
5.25k
    addDirectiveHandler<
159
5.25k
      &DarwinAsmParser::parseSectionDirectiveObjCMethVarTypes>(
160
5.25k
        ".objc_meth_var_types");
161
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCModuleInfo>(
162
5.25k
      ".objc_module_info");
163
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCProtocol>(
164
5.25k
      ".objc_protocol");
165
5.25k
    addDirectiveHandler<
166
5.25k
      &DarwinAsmParser::parseSectionDirectiveObjCSelectorStrs>(
167
5.25k
        ".objc_selector_strs");
168
5.25k
    addDirectiveHandler<
169
5.25k
      &DarwinAsmParser::parseSectionDirectiveObjCStringObject>(
170
5.25k
        ".objc_string_object");
171
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCSymbols>(
172
5.25k
      ".objc_symbols");
173
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectivePICSymbolStub>(
174
5.25k
      ".picsymbol_stub");
175
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveStaticConst>(
176
5.25k
      ".static_const");
177
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveStaticData>(
178
5.25k
      ".static_data");
179
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveSymbolStub>(
180
5.25k
      ".symbol_stub");
181
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveTData>(".tdata");
182
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveText>(".text");
183
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveThreadInitFunc>(
184
5.25k
      ".thread_init_func");
185
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveTLV>(".tlv");
186
5.25k
187
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveIdent>(".ident");
188
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseWatchOSVersionMin>(
189
5.25k
      ".watchos_version_min");
190
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseTvOSVersionMin>(
191
5.25k
      ".tvos_version_min");
192
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseIOSVersionMin>(
193
5.25k
      ".ios_version_min");
194
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseMacOSXVersionMin>(
195
5.25k
      ".macosx_version_min");
196
5.25k
    addDirectiveHandler<&DarwinAsmParser::parseBuildVersion>(".build_version");
197
5.25k
198
5.25k
    LastVersionDirective = SMLoc();
199
5.25k
  }
200
201
  bool parseDirectiveAltEntry(StringRef, SMLoc);
202
  bool parseDirectiveDesc(StringRef, SMLoc);
203
  bool parseDirectiveIndirectSymbol(StringRef, SMLoc);
204
  bool parseDirectiveDumpOrLoad(StringRef, SMLoc);
205
  bool parseDirectiveLsym(StringRef, SMLoc);
206
  bool parseDirectiveLinkerOption(StringRef, SMLoc);
207
  bool parseDirectiveSection(StringRef, SMLoc);
208
  bool parseDirectivePushSection(StringRef, SMLoc);
209
  bool parseDirectivePopSection(StringRef, SMLoc);
210
  bool parseDirectivePrevious(StringRef, SMLoc);
211
  bool parseDirectiveSecureLogReset(StringRef, SMLoc);
212
  bool parseDirectiveSecureLogUnique(StringRef, SMLoc);
213
  bool parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc);
214
  bool parseDirectiveTBSS(StringRef, SMLoc);
215
  bool parseDirectiveZerofill(StringRef, SMLoc);
216
  bool parseDirectiveDataRegion(StringRef, SMLoc);
217
  bool parseDirectiveDataRegionEnd(StringRef, SMLoc);
218
219
  // Named Section Directive
220
2
  bool parseSectionDirectiveBss(StringRef, SMLoc) {
221
2
    return parseSectionSwitch("__DATA", "__bss");
222
2
  }
223
224
40
  bool parseSectionDirectiveConst(StringRef, SMLoc) {
225
40
    return parseSectionSwitch("__TEXT", "__const");
226
40
  }
227
228
4
  bool parseSectionDirectiveStaticConst(StringRef, SMLoc) {
229
4
    return parseSectionSwitch("__TEXT", "__static_const");
230
4
  }
231
232
10
  bool parseSectionDirectiveCString(StringRef, SMLoc) {
233
10
    return parseSectionSwitch("__TEXT","__cstring",
234
10
                              MachO::S_CSTRING_LITERALS);
235
10
  }
236
237
14
  bool parseSectionDirectiveLiteral4(StringRef, SMLoc) {
238
14
    return parseSectionSwitch("__TEXT", "__literal4",
239
14
                              MachO::S_4BYTE_LITERALS, 4);
240
14
  }
241
242
14
  bool parseSectionDirectiveLiteral8(StringRef, SMLoc) {
243
14
    return parseSectionSwitch("__TEXT", "__literal8",
244
14
                              MachO::S_8BYTE_LITERALS, 8);
245
14
  }
246
247
14
  bool parseSectionDirectiveLiteral16(StringRef, SMLoc) {
248
14
    return parseSectionSwitch("__TEXT","__literal16",
249
14
                              MachO::S_16BYTE_LITERALS, 16);
250
14
  }
251
252
4
  bool parseSectionDirectiveConstructor(StringRef, SMLoc) {
253
4
    return parseSectionSwitch("__TEXT","__constructor");
254
4
  }
255
256
4
  bool parseSectionDirectiveDestructor(StringRef, SMLoc) {
257
4
    return parseSectionSwitch("__TEXT","__destructor");
258
4
  }
259
260
0
  bool parseSectionDirectiveFVMLibInit0(StringRef, SMLoc) {
261
0
    return parseSectionSwitch("__TEXT","__fvmlib_init0");
262
0
  }
263
264
0
  bool parseSectionDirectiveFVMLibInit1(StringRef, SMLoc) {
265
0
    return parseSectionSwitch("__TEXT","__fvmlib_init1");
266
0
  }
267
268
2
  bool parseSectionDirectiveSymbolStub(StringRef, SMLoc) {
269
2
    return parseSectionSwitch("__TEXT","__symbol_stub",
270
2
                              MachO::S_SYMBOL_STUBS |
271
2
                              MachO::S_ATTR_PURE_INSTRUCTIONS,
272
2
                              // FIXME: Different on PPC and ARM.
273
2
                              0, 16);
274
2
  }
275
276
2
  bool parseSectionDirectivePICSymbolStub(StringRef, SMLoc) {
277
2
    return parseSectionSwitch("__TEXT","__picsymbol_stub",
278
2
                              MachO::S_SYMBOL_STUBS |
279
2
                              MachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
280
2
  }
281
282
49
  bool parseSectionDirectiveData(StringRef, SMLoc) {
283
49
    return parseSectionSwitch("__DATA", "__data");
284
49
  }
285
286
4
  bool parseSectionDirectiveStaticData(StringRef, SMLoc) {
287
4
    return parseSectionSwitch("__DATA", "__static_data");
288
4
  }
289
290
3
  bool parseSectionDirectiveNonLazySymbolPointers(StringRef, SMLoc) {
291
3
    return parseSectionSwitch("__DATA", "__nl_symbol_ptr",
292
3
                              MachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
293
3
  }
294
295
3
  bool parseSectionDirectiveLazySymbolPointers(StringRef, SMLoc) {
296
3
    return parseSectionSwitch("__DATA", "__la_symbol_ptr",
297
3
                              MachO::S_LAZY_SYMBOL_POINTERS, 4);
298
3
  }
299
300
0
  bool parseSectionDirectiveThreadLocalVariablePointers(StringRef, SMLoc) {
301
0
    return parseSectionSwitch("__DATA", "__thread_ptr",
302
0
                              MachO::S_THREAD_LOCAL_VARIABLE_POINTERS, 4);
303
0
  }
304
305
4
  bool parseSectionDirectiveDyld(StringRef, SMLoc) {
306
4
    return parseSectionSwitch("__DATA", "__dyld");
307
4
  }
308
309
4
  bool parseSectionDirectiveModInitFunc(StringRef, SMLoc) {
310
4
    return parseSectionSwitch("__DATA", "__mod_init_func",
311
4
                              MachO::S_MOD_INIT_FUNC_POINTERS, 4);
312
4
  }
313
314
4
  bool parseSectionDirectiveModTermFunc(StringRef, SMLoc) {
315
4
    return parseSectionSwitch("__DATA", "__mod_term_func",
316
4
                              MachO::S_MOD_TERM_FUNC_POINTERS, 4);
317
4
  }
318
319
4
  bool parseSectionDirectiveConstData(StringRef, SMLoc) {
320
4
    return parseSectionSwitch("__DATA", "__const");
321
4
  }
322
323
4
  bool parseSectionDirectiveObjCClass(StringRef, SMLoc) {
324
4
    return parseSectionSwitch("__OBJC", "__class",
325
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
326
4
  }
327
328
4
  bool parseSectionDirectiveObjCMetaClass(StringRef, SMLoc) {
329
4
    return parseSectionSwitch("__OBJC", "__meta_class",
330
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
331
4
  }
332
333
4
  bool parseSectionDirectiveObjCCatClsMeth(StringRef, SMLoc) {
334
4
    return parseSectionSwitch("__OBJC", "__cat_cls_meth",
335
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
336
4
  }
337
338
4
  bool parseSectionDirectiveObjCCatInstMeth(StringRef, SMLoc) {
339
4
    return parseSectionSwitch("__OBJC", "__cat_inst_meth",
340
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
341
4
  }
342
343
4
  bool parseSectionDirectiveObjCProtocol(StringRef, SMLoc) {
344
4
    return parseSectionSwitch("__OBJC", "__protocol",
345
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
346
4
  }
347
348
4
  bool parseSectionDirectiveObjCStringObject(StringRef, SMLoc) {
349
4
    return parseSectionSwitch("__OBJC", "__string_object",
350
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
351
4
  }
352
353
4
  bool parseSectionDirectiveObjCClsMeth(StringRef, SMLoc) {
354
4
    return parseSectionSwitch("__OBJC", "__cls_meth",
355
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
356
4
  }
357
358
4
  bool parseSectionDirectiveObjCInstMeth(StringRef, SMLoc) {
359
4
    return parseSectionSwitch("__OBJC", "__inst_meth",
360
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
361
4
  }
362
363
4
  bool parseSectionDirectiveObjCClsRefs(StringRef, SMLoc) {
364
4
    return parseSectionSwitch("__OBJC", "__cls_refs",
365
4
                              MachO::S_ATTR_NO_DEAD_STRIP |
366
4
                              MachO::S_LITERAL_POINTERS, 4);
367
4
  }
368
369
4
  bool parseSectionDirectiveObjCMessageRefs(StringRef, SMLoc) {
370
4
    return parseSectionSwitch("__OBJC", "__message_refs",
371
4
                              MachO::S_ATTR_NO_DEAD_STRIP |
372
4
                              MachO::S_LITERAL_POINTERS, 4);
373
4
  }
374
375
4
  bool parseSectionDirectiveObjCSymbols(StringRef, SMLoc) {
376
4
    return parseSectionSwitch("__OBJC", "__symbols",
377
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
378
4
  }
379
380
4
  bool parseSectionDirectiveObjCCategory(StringRef, SMLoc) {
381
4
    return parseSectionSwitch("__OBJC", "__category",
382
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
383
4
  }
384
385
4
  bool parseSectionDirectiveObjCClassVars(StringRef, SMLoc) {
386
4
    return parseSectionSwitch("__OBJC", "__class_vars",
387
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
388
4
  }
389
390
4
  bool parseSectionDirectiveObjCInstanceVars(StringRef, SMLoc) {
391
4
    return parseSectionSwitch("__OBJC", "__instance_vars",
392
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
393
4
  }
394
395
4
  bool parseSectionDirectiveObjCModuleInfo(StringRef, SMLoc) {
396
4
    return parseSectionSwitch("__OBJC", "__module_info",
397
4
                              MachO::S_ATTR_NO_DEAD_STRIP);
398
4
  }
399
400
4
  bool parseSectionDirectiveObjCClassNames(StringRef, SMLoc) {
401
4
    return parseSectionSwitch("__TEXT", "__cstring",
402
4
                              MachO::S_CSTRING_LITERALS);
403
4
  }
404
405
4
  bool parseSectionDirectiveObjCMethVarTypes(StringRef, SMLoc) {
406
4
    return parseSectionSwitch("__TEXT", "__cstring",
407
4
                              MachO::S_CSTRING_LITERALS);
408
4
  }
409
410
4
  bool parseSectionDirectiveObjCMethVarNames(StringRef, SMLoc) {
411
4
    return parseSectionSwitch("__TEXT", "__cstring",
412
4
                              MachO::S_CSTRING_LITERALS);
413
4
  }
414
415
4
  bool parseSectionDirectiveObjCSelectorStrs(StringRef, SMLoc) {
416
4
    return parseSectionSwitch("__OBJC", "__selector_strs",
417
4
                              MachO::S_CSTRING_LITERALS);
418
4
  }
419
420
3
  bool parseSectionDirectiveTData(StringRef, SMLoc) {
421
3
    return parseSectionSwitch("__DATA", "__thread_data",
422
3
                              MachO::S_THREAD_LOCAL_REGULAR);
423
3
  }
424
425
352
  bool parseSectionDirectiveText(StringRef, SMLoc) {
426
352
    return parseSectionSwitch("__TEXT", "__text",
427
352
                              MachO::S_ATTR_PURE_INSTRUCTIONS);
428
352
  }
429
430
3
  bool parseSectionDirectiveTLV(StringRef, SMLoc) {
431
3
    return parseSectionSwitch("__DATA", "__thread_vars",
432
3
                              MachO::S_THREAD_LOCAL_VARIABLES);
433
3
  }
434
435
0
  bool parseSectionDirectiveIdent(StringRef, SMLoc) {
436
0
    // Darwin silently ignores the .ident directive.
437
0
    getParser().eatToEndOfStatement();
438
0
    return false;
439
0
  }
440
441
2
  bool parseSectionDirectiveThreadInitFunc(StringRef, SMLoc) {
442
2
    return parseSectionSwitch("__DATA", "__thread_init",
443
2
                         MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
444
2
  }
445
446
29
  bool parseWatchOSVersionMin(StringRef Directive, SMLoc Loc) {
447
29
    return parseVersionMin(Directive, Loc, MCVM_WatchOSVersionMin);
448
29
  }
449
29
  bool parseTvOSVersionMin(StringRef Directive, SMLoc Loc) {
450
29
    return parseVersionMin(Directive, Loc, MCVM_TvOSVersionMin);
451
29
  }
452
30
  bool parseIOSVersionMin(StringRef Directive, SMLoc Loc) {
453
30
    return parseVersionMin(Directive, Loc, MCVM_IOSVersionMin);
454
30
  }
455
83
  bool parseMacOSXVersionMin(StringRef Directive, SMLoc Loc) {
456
83
    return parseVersionMin(Directive, Loc, MCVM_OSXVersionMin);
457
83
  }
458
459
  bool parseBuildVersion(StringRef Directive, SMLoc Loc);
460
  bool parseVersionMin(StringRef Directive, SMLoc Loc, MCVersionMinType Type);
461
  bool parseMajorMinorVersionComponent(unsigned *Major, unsigned *Minor,
462
                                       const char *VersionName);
463
  bool parseOptionalTrailingVersionComponent(unsigned *Component,
464
                                             const char *ComponentName);
465
  bool parseVersion(unsigned *Major, unsigned *Minor, unsigned *Update);
466
  bool parseSDKVersion(VersionTuple &SDKVersion);
467
  void checkVersion(StringRef Directive, StringRef Arg, SMLoc Loc,
468
                    Triple::OSType ExpectedOS);
469
};
470
471
} // end anonymous namespace
472
473
bool DarwinAsmParser::parseSectionSwitch(StringRef Segment, StringRef Section,
474
                                         unsigned TAA, unsigned Align,
475
621
                                         unsigned StubSize) {
476
621
  if (getLexer().isNot(AsmToken::EndOfStatement))
477
0
    return TokError("unexpected token in section switching directive");
478
621
  Lex();
479
621
480
621
  // FIXME: Arch specific.
481
621
  bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
482
621
  getStreamer().SwitchSection(getContext().getMachOSection(
483
621
      Segment, Section, TAA, StubSize,
484
621
      isText ? 
SectionKind::getText()356
:
SectionKind::getData()265
));
485
621
486
621
  // Set the implicit alignment, if any.
487
621
  //
488
621
  // FIXME: This isn't really what 'as' does; I think it just uses the implicit
489
621
  // alignment on the section (e.g., if one manually inserts bytes into the
490
621
  // section, then just issuing the section switch directive will not realign
491
621
  // the section. However, this is arguably more reasonable behavior, and there
492
621
  // is no good reason for someone to intentionally emit incorrectly sized
493
621
  // values into the implicitly aligned sections.
494
621
  if (Align)
495
64
    getStreamer().EmitValueToAlignment(Align);
496
621
497
621
  return false;
498
621
}
499
500
/// parseDirectiveAltEntry
501
///  ::= .alt_entry identifier
502
8
bool DarwinAsmParser::parseDirectiveAltEntry(StringRef, SMLoc) {
503
8
  StringRef Name;
504
8
  if (getParser().parseIdentifier(Name))
505
0
    return TokError("expected identifier in directive");
506
8
507
8
  // Look up symbol.
508
8
  MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
509
8
510
8
  if (Sym->isDefined())
511
0
    return TokError(".alt_entry must preceed symbol definition");
512
8
513
8
  if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_AltEntry))
514
0
    return TokError("unable to emit symbol attribute");
515
8
516
8
  Lex();
517
8
  return false;
518
8
}
519
520
/// parseDirectiveDesc
521
///  ::= .desc identifier , expression
522
995
bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) {
523
995
  StringRef Name;
524
995
  if (getParser().parseIdentifier(Name))
525
0
    return TokError("expected identifier in directive");
526
995
527
995
  // Handle the identifier as the key symbol.
528
995
  MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
529
995
530
995
  if (getLexer().isNot(AsmToken::Comma))
531
0
    return TokError("unexpected token in '.desc' directive");
532
995
  Lex();
533
995
534
995
  int64_t DescValue;
535
995
  if (getParser().parseAbsoluteExpression(DescValue))
536
0
    return true;
537
995
538
995
  if (getLexer().isNot(AsmToken::EndOfStatement))
539
0
    return TokError("unexpected token in '.desc' directive");
540
995
541
995
  Lex();
542
995
543
995
  // Set the n_desc field of this Symbol to this DescValue
544
995
  getStreamer().EmitSymbolDesc(Sym, DescValue);
545
995
546
995
  return false;
547
995
}
548
549
/// parseDirectiveIndirectSymbol
550
///  ::= .indirect_symbol identifier
551
31
bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
552
31
  const MCSectionMachO *Current = static_cast<const MCSectionMachO *>(
553
31
      getStreamer().getCurrentSectionOnly());
554
31
  MachO::SectionType SectionType = Current->getType();
555
31
  if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
556
31
      
SectionType != MachO::S_LAZY_SYMBOL_POINTERS13
&&
557
31
      
SectionType != MachO::S_THREAD_LOCAL_VARIABLE_POINTERS7
&&
558
31
      
SectionType != MachO::S_SYMBOL_STUBS6
)
559
1
    return Error(Loc, "indirect symbol not in a symbol pointer or stub "
560
1
                      "section");
561
30
562
30
  StringRef Name;
563
30
  if (getParser().parseIdentifier(Name))
564
0
    return TokError("expected identifier in .indirect_symbol directive");
565
30
566
30
  MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
567
30
568
30
  // Assembler local symbols don't make any sense here. Complain loudly.
569
30
  if (Sym->isTemporary())
570
0
    return TokError("non-local symbol required in directive");
571
30
572
30
  if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_IndirectSymbol))
573
0
    return TokError("unable to emit indirect symbol attribute for: " + Name);
574
30
575
30
  if (getLexer().isNot(AsmToken::EndOfStatement))
576
0
    return TokError("unexpected token in '.indirect_symbol' directive");
577
30
578
30
  Lex();
579
30
580
30
  return false;
581
30
}
582
583
/// parseDirectiveDumpOrLoad
584
///  ::= ( .dump | .load ) "filename"
585
bool DarwinAsmParser::parseDirectiveDumpOrLoad(StringRef Directive,
586
0
                                               SMLoc IDLoc) {
587
0
  bool IsDump = Directive == ".dump";
588
0
  if (getLexer().isNot(AsmToken::String))
589
0
    return TokError("expected string in '.dump' or '.load' directive");
590
0
591
0
  Lex();
592
0
593
0
  if (getLexer().isNot(AsmToken::EndOfStatement))
594
0
    return TokError("unexpected token in '.dump' or '.load' directive");
595
0
596
0
  Lex();
597
0
598
0
  // FIXME: If/when .dump and .load are implemented they will be done in the
599
0
  // the assembly parser and not have any need for an MCStreamer API.
600
0
  if (IsDump)
601
0
    return Warning(IDLoc, "ignoring directive .dump for now");
602
0
  else
603
0
    return Warning(IDLoc, "ignoring directive .load for now");
604
0
}
605
606
/// ParseDirectiveLinkerOption
607
///  ::= .linker_option "string" ( , "string" )*
608
7
bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
609
7
  SmallVector<std::string, 4> Args;
610
10
  while (true) {
611
10
    if (getLexer().isNot(AsmToken::String))
612
2
      return TokError("expected string in '" + Twine(IDVal) + "' directive");
613
8
614
8
    std::string Data;
615
8
    if (getParser().parseEscapedString(Data))
616
0
      return true;
617
8
618
8
    Args.push_back(Data);
619
8
620
8
    if (getLexer().is(AsmToken::EndOfStatement))
621
4
      break;
622
4
623
4
    if (getLexer().isNot(AsmToken::Comma))
624
1
      return TokError("unexpected token in '" + Twine(IDVal) + "' directive");
625
3
    Lex();
626
3
  }
627
7
628
7
  getStreamer().EmitLinkerOptions(Args);
629
4
  return false;
630
7
}
631
632
/// parseDirectiveLsym
633
///  ::= .lsym identifier , expression
634
0
bool DarwinAsmParser::parseDirectiveLsym(StringRef, SMLoc) {
635
0
  StringRef Name;
636
0
  if (getParser().parseIdentifier(Name))
637
0
    return TokError("expected identifier in directive");
638
0
639
0
  // Handle the identifier as the key symbol.
640
0
  MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
641
0
642
0
  if (getLexer().isNot(AsmToken::Comma))
643
0
    return TokError("unexpected token in '.lsym' directive");
644
0
  Lex();
645
0
646
0
  const MCExpr *Value;
647
0
  if (getParser().parseExpression(Value))
648
0
    return true;
649
0
650
0
  if (getLexer().isNot(AsmToken::EndOfStatement))
651
0
    return TokError("unexpected token in '.lsym' directive");
652
0
653
0
  Lex();
654
0
655
0
  // We don't currently support this directive.
656
0
  //
657
0
  // FIXME: Diagnostic location!
658
0
  (void) Sym;
659
0
  return TokError("directive '.lsym' is unsupported");
660
0
}
661
662
/// parseDirectiveSection:
663
///   ::= .section identifier (',' identifier)*
664
781
bool DarwinAsmParser::parseDirectiveSection(StringRef, SMLoc) {
665
781
  SMLoc Loc = getLexer().getLoc();
666
781
667
781
  StringRef SectionName;
668
781
  if (getParser().parseIdentifier(SectionName))
669
0
    return Error(Loc, "expected identifier after '.section' directive");
670
781
671
781
  // Verify there is a following comma.
672
781
  if (!getLexer().is(AsmToken::Comma))
673
0
    return TokError("unexpected token in '.section' directive");
674
781
675
781
  std::string SectionSpec = SectionName;
676
781
  SectionSpec += ",";
677
781
678
781
  // Add all the tokens until the end of the line, ParseSectionSpecifier will
679
781
  // handle this.
680
781
  StringRef EOL = getLexer().LexUntilEndOfStatement();
681
781
  SectionSpec.append(EOL.begin(), EOL.end());
682
781
683
781
  Lex();
684
781
  if (getLexer().isNot(AsmToken::EndOfStatement))
685
0
    return TokError("unexpected token in '.section' directive");
686
781
  Lex();
687
781
688
781
  StringRef Segment, Section;
689
781
  unsigned StubSize;
690
781
  unsigned TAA;
691
781
  bool TAAParsed;
692
781
  std::string ErrorStr =
693
781
    MCSectionMachO::ParseSectionSpecifier(SectionSpec, Segment, Section,
694
781
                                          TAA, TAAParsed, StubSize);
695
781
696
781
  if (!ErrorStr.empty())
697
0
    return Error(Loc, ErrorStr);
698
781
699
781
  // Issue a warning if the target is not powerpc and Section is a *coal* section.
700
781
  Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple();
701
781
  Triple::ArchType ArchTy = TT.getArch();
702
781
703
781
  if (ArchTy != Triple::ppc && 
ArchTy != Triple::ppc64768
) {
704
768
    StringRef NonCoalSection = StringSwitch<StringRef>(Section)
705
768
                                   .Case("__textcoal_nt", "__text")
706
768
                                   .Case("__const_coal", "__const")
707
768
                                   .Case("__datacoal_nt", "__data")
708
768
                                   .Default(Section);
709
768
710
768
    if (!Section.equals(NonCoalSection)) {
711
6
      StringRef SectionVal(Loc.getPointer());
712
6
      size_t B = SectionVal.find(',') + 1, E = SectionVal.find(',', B);
713
6
      SMLoc BLoc = SMLoc::getFromPointer(SectionVal.data() + B);
714
6
      SMLoc ELoc = SMLoc::getFromPointer(SectionVal.data() + E);
715
6
      getParser().Warning(Loc, "section \"" + Section + "\" is deprecated",
716
6
                          SMRange(BLoc, ELoc));
717
6
      getParser().Note(Loc, "change section name to \"" + NonCoalSection +
718
6
                       "\"", SMRange(BLoc, ELoc));
719
6
    }
720
768
  }
721
781
722
781
  // FIXME: Arch specific.
723
781
  bool isText = Segment == "__TEXT";  // FIXME: Hack.
724
781
  getStreamer().SwitchSection(getContext().getMachOSection(
725
781
      Segment, Section, TAA, StubSize,
726
781
      isText ? 
SectionKind::getText()226
:
SectionKind::getData()555
));
727
781
  return false;
728
781
}
729
730
/// ParseDirectivePushSection:
731
///   ::= .pushsection identifier (',' identifier)*
732
2
bool DarwinAsmParser::parseDirectivePushSection(StringRef S, SMLoc Loc) {
733
2
  getStreamer().PushSection();
734
2
735
2
  if (parseDirectiveSection(S, Loc)) {
736
0
    getStreamer().PopSection();
737
0
    return true;
738
0
  }
739
2
740
2
  return false;
741
2
}
742
743
/// ParseDirectivePopSection:
744
///   ::= .popsection
745
2
bool DarwinAsmParser::parseDirectivePopSection(StringRef, SMLoc) {
746
2
  if (!getStreamer().PopSection())
747
0
    return TokError(".popsection without corresponding .pushsection");
748
2
  return false;
749
2
}
750
751
/// ParseDirectivePrevious:
752
///   ::= .previous
753
2
bool DarwinAsmParser::parseDirectivePrevious(StringRef DirName, SMLoc) {
754
2
  MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
755
2
  if (!PreviousSection.first)
756
0
    return TokError(".previous without corresponding .section");
757
2
  getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second);
758
2
  return false;
759
2
}
760
761
/// ParseDirectiveSecureLogUnique
762
///  ::= .secure_log_unique ... message ...
763
2
bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
764
2
  StringRef LogMessage = getParser().parseStringToEndOfStatement();
765
2
  if (getLexer().isNot(AsmToken::EndOfStatement))
766
0
    return TokError("unexpected token in '.secure_log_unique' directive");
767
2
768
2
  if (getContext().getSecureLogUsed())
769
0
    return Error(IDLoc, ".secure_log_unique specified multiple times");
770
2
771
2
  // Get the secure log path.
772
2
  const char *SecureLogFile = getContext().getSecureLogFile();
773
2
  if (!SecureLogFile)
774
0
    return Error(IDLoc, ".secure_log_unique used but AS_SECURE_LOG_FILE "
775
0
                 "environment variable unset.");
776
2
777
2
  // Open the secure log file if we haven't already.
778
2
  raw_fd_ostream *OS = getContext().getSecureLog();
779
2
  if (!OS) {
780
2
    std::error_code EC;
781
2
    auto NewOS = llvm::make_unique<raw_fd_ostream>(
782
2
        StringRef(SecureLogFile), EC, sys::fs::F_Append | sys::fs::F_Text);
783
2
    if (EC)
784
0
       return Error(IDLoc, Twine("can't open secure log file: ") +
785
0
                               SecureLogFile + " (" + EC.message() + ")");
786
2
    OS = NewOS.get();
787
2
    getContext().setSecureLog(std::move(NewOS));
788
2
  }
789
2
790
2
  // Write the message.
791
2
  unsigned CurBuf = getSourceManager().FindBufferContainingLoc(IDLoc);
792
2
  *OS << getSourceManager().getBufferInfo(CurBuf).Buffer->getBufferIdentifier()
793
2
      << ":" << getSourceManager().FindLineNumber(IDLoc, CurBuf) << ":"
794
2
      << LogMessage + "\n";
795
2
796
2
  getContext().setSecureLogUsed(true);
797
2
798
2
  return false;
799
2
}
800
801
/// ParseDirectiveSecureLogReset
802
///  ::= .secure_log_reset
803
0
bool DarwinAsmParser::parseDirectiveSecureLogReset(StringRef, SMLoc IDLoc) {
804
0
  if (getLexer().isNot(AsmToken::EndOfStatement))
805
0
    return TokError("unexpected token in '.secure_log_reset' directive");
806
0
807
0
  Lex();
808
0
809
0
  getContext().setSecureLogUsed(false);
810
0
811
0
  return false;
812
0
}
813
814
/// parseDirectiveSubsectionsViaSymbols
815
///  ::= .subsections_via_symbols
816
869
bool DarwinAsmParser::parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) {
817
869
  if (getLexer().isNot(AsmToken::EndOfStatement))
818
0
    return TokError("unexpected token in '.subsections_via_symbols' directive");
819
869
820
869
  Lex();
821
869
822
869
  getStreamer().EmitAssemblerFlag(MCAF_SubsectionsViaSymbols);
823
869
824
869
  return false;
825
869
}
826
827
/// ParseDirectiveTBSS
828
///  ::= .tbss identifier, size, align
829
7
bool DarwinAsmParser::parseDirectiveTBSS(StringRef, SMLoc) {
830
7
  SMLoc IDLoc = getLexer().getLoc();
831
7
  StringRef Name;
832
7
  if (getParser().parseIdentifier(Name))
833
0
    return TokError("expected identifier in directive");
834
7
835
7
  // Handle the identifier as the key symbol.
836
7
  MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
837
7
838
7
  if (getLexer().isNot(AsmToken::Comma))
839
0
    return TokError("unexpected token in directive");
840
7
  Lex();
841
7
842
7
  int64_t Size;
843
7
  SMLoc SizeLoc = getLexer().getLoc();
844
7
  if (getParser().parseAbsoluteExpression(Size))
845
0
    return true;
846
7
847
7
  int64_t Pow2Alignment = 0;
848
7
  SMLoc Pow2AlignmentLoc;
849
7
  if (getLexer().is(AsmToken::Comma)) {
850
5
    Lex();
851
5
    Pow2AlignmentLoc = getLexer().getLoc();
852
5
    if (getParser().parseAbsoluteExpression(Pow2Alignment))
853
0
      return true;
854
7
  }
855
7
856
7
  if (getLexer().isNot(AsmToken::EndOfStatement))
857
0
    return TokError("unexpected token in '.tbss' directive");
858
7
859
7
  Lex();
860
7
861
7
  if (Size < 0)
862
0
    return Error(SizeLoc, "invalid '.tbss' directive size, can't be less than"
863
0
                 "zero");
864
7
865
7
  // FIXME: Diagnose overflow.
866
7
  if (Pow2Alignment < 0)
867
0
    return Error(Pow2AlignmentLoc, "invalid '.tbss' alignment, can't be less"
868
0
                 "than zero");
869
7
870
7
  if (!Sym->isUndefined())
871
0
    return Error(IDLoc, "invalid symbol redefinition");
872
7
873
7
  getStreamer().EmitTBSSSymbol(getContext().getMachOSection(
874
7
                                 "__DATA", "__thread_bss",
875
7
                                 MachO::S_THREAD_LOCAL_ZEROFILL,
876
7
                                 0, SectionKind::getThreadBSS()),
877
7
                               Sym, Size, 1 << Pow2Alignment);
878
7
879
7
  return false;
880
7
}
881
882
/// ParseDirectiveZerofill
883
///  ::= .zerofill segname , sectname [, identifier , size_expression [
884
///      , align_expression ]]
885
27
bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
886
27
  StringRef Segment;
887
27
  if (getParser().parseIdentifier(Segment))
888
0
    return TokError("expected segment name after '.zerofill' directive");
889
27
890
27
  if (getLexer().isNot(AsmToken::Comma))
891
0
    return TokError("unexpected token in directive");
892
27
  Lex();
893
27
894
27
  StringRef Section;
895
27
  SMLoc SectionLoc = getLexer().getLoc();
896
27
  if (getParser().parseIdentifier(Section))
897
0
    return TokError("expected section name after comma in '.zerofill' "
898
0
                    "directive");
899
27
900
27
  // If this is the end of the line all that was wanted was to create the
901
27
  // the section but with no symbol.
902
27
  if (getLexer().is(AsmToken::EndOfStatement)) {
903
1
    // Create the zerofill section but no symbol
904
1
    getStreamer().EmitZerofill(
905
1
        getContext().getMachOSection(Segment, Section, MachO::S_ZEROFILL, 0,
906
1
                                     SectionKind::getBSS()),
907
1
        /*Symbol=*/nullptr, /*Size=*/0, /*ByteAlignment=*/0, SectionLoc);
908
1
    return false;
909
1
  }
910
26
911
26
  if (getLexer().isNot(AsmToken::Comma))
912
0
    return TokError("unexpected token in directive");
913
26
  Lex();
914
26
915
26
  SMLoc IDLoc = getLexer().getLoc();
916
26
  StringRef IDStr;
917
26
  if (getParser().parseIdentifier(IDStr))
918
0
    return TokError("expected identifier in directive");
919
26
920
26
  // handle the identifier as the key symbol.
921
26
  MCSymbol *Sym = getContext().getOrCreateSymbol(IDStr);
922
26
923
26
  if (getLexer().isNot(AsmToken::Comma))
924
0
    return TokError("unexpected token in directive");
925
26
  Lex();
926
26
927
26
  int64_t Size;
928
26
  SMLoc SizeLoc = getLexer().getLoc();
929
26
  if (getParser().parseAbsoluteExpression(Size))
930
0
    return true;
931
26
932
26
  int64_t Pow2Alignment = 0;
933
26
  SMLoc Pow2AlignmentLoc;
934
26
  if (getLexer().is(AsmToken::Comma)) {
935
21
    Lex();
936
21
    Pow2AlignmentLoc = getLexer().getLoc();
937
21
    if (getParser().parseAbsoluteExpression(Pow2Alignment))
938
0
      return true;
939
26
  }
940
26
941
26
  if (getLexer().isNot(AsmToken::EndOfStatement))
942
0
    return TokError("unexpected token in '.zerofill' directive");
943
26
944
26
  Lex();
945
26
946
26
  if (Size < 0)
947
0
    return Error(SizeLoc, "invalid '.zerofill' directive size, can't be less "
948
0
                 "than zero");
949
26
950
26
  // NOTE: The alignment in the directive is a power of 2 value, the assembler
951
26
  // may internally end up wanting an alignment in bytes.
952
26
  // FIXME: Diagnose overflow.
953
26
  if (Pow2Alignment < 0)
954
0
    return Error(Pow2AlignmentLoc, "invalid '.zerofill' directive alignment, "
955
0
                 "can't be less than zero");
956
26
957
26
  if (!Sym->isUndefined())
958
0
    return Error(IDLoc, "invalid symbol redefinition");
959
26
960
26
  // Create the zerofill Symbol with Size and Pow2Alignment
961
26
  //
962
26
  // FIXME: Arch specific.
963
26
  getStreamer().EmitZerofill(getContext().getMachOSection(
964
26
                               Segment, Section, MachO::S_ZEROFILL,
965
26
                               0, SectionKind::getBSS()),
966
26
                             Sym, Size, 1 << Pow2Alignment, SectionLoc);
967
26
968
26
  return false;
969
26
}
970
971
/// ParseDirectiveDataRegion
972
///  ::= .data_region [ ( jt8 | jt16 | jt32 ) ]
973
19
bool DarwinAsmParser::parseDirectiveDataRegion(StringRef, SMLoc) {
974
19
  if (getLexer().is(AsmToken::EndOfStatement)) {
975
6
    Lex();
976
6
    getStreamer().EmitDataRegion(MCDR_DataRegion);
977
6
    return false;
978
6
  }
979
13
  StringRef RegionType;
980
13
  SMLoc Loc = getParser().getTok().getLoc();
981
13
  if (getParser().parseIdentifier(RegionType))
982
0
    return TokError("expected region type after '.data_region' directive");
983
13
  int Kind = StringSwitch<int>(RegionType)
984
13
    .Case("jt8", MCDR_DataRegionJT8)
985
13
    .Case("jt16", MCDR_DataRegionJT16)
986
13
    .Case("jt32", MCDR_DataRegionJT32)
987
13
    .Default(-1);
988
13
  if (Kind == -1)
989
0
    return Error(Loc, "unknown region type in '.data_region' directive");
990
13
  Lex();
991
13
992
13
  getStreamer().EmitDataRegion((MCDataRegionType)Kind);
993
13
  return false;
994
13
}
995
996
/// ParseDirectiveDataRegionEnd
997
///  ::= .end_data_region
998
18
bool DarwinAsmParser::parseDirectiveDataRegionEnd(StringRef, SMLoc) {
999
18
  if (getLexer().isNot(AsmToken::EndOfStatement))
1000
0
    return TokError("unexpected token in '.end_data_region' directive");
1001
18
1002
18
  Lex();
1003
18
  getStreamer().EmitDataRegion(MCDR_DataRegionEnd);
1004
18
  return false;
1005
18
}
1006
1007
218
static bool isSDKVersionToken(const AsmToken &Tok) {
1008
218
  return Tok.is(AsmToken::Identifier) && 
Tok.getIdentifier() == "sdk_version"19
;
1009
218
}
1010
1011
/// parseMajorMinorVersionComponent ::= major, minor
1012
bool DarwinAsmParser::parseMajorMinorVersionComponent(unsigned *Major,
1013
                                                      unsigned *Minor,
1014
224
                                                      const char *VersionName) {
1015
224
  // Get the major version number.
1016
224
  if (getLexer().isNot(AsmToken::Integer))
1017
3
    return TokError(Twine("invalid ") + VersionName +
1018
3
                    " major version number, integer expected");
1019
221
  int64_t MajorVal = getLexer().getTok().getIntVal();
1020
221
  if (MajorVal > 65535 || 
MajorVal <= 0208
)
1021
26
    return TokError(Twine("invalid ") + VersionName + " major version number");
1022
195
  *Major = (unsigned)MajorVal;
1023
195
  Lex();
1024
195
  if (getLexer().isNot(AsmToken::Comma))
1025
4
    return TokError(Twine(VersionName) +
1026
4
                    " minor version number required, comma expected");
1027
191
  Lex();
1028
191
  // Get the minor version number.
1029
191
  if (getLexer().isNot(AsmToken::Integer))
1030
16
    return TokError(Twine("invalid ") + VersionName +
1031
16
                    " minor version number, integer expected");
1032
175
  int64_t MinorVal = getLexer().getTok().getIntVal();
1033
175
  if (MinorVal > 255 || 
MinorVal < 0161
)
1034
14
    return TokError(Twine("invalid ") + VersionName + " minor version number");
1035
161
  *Minor = MinorVal;
1036
161
  Lex();
1037
161
  return false;
1038
161
}
1039
1040
/// parseOptionalTrailingVersionComponent ::= , version_number
1041
bool DarwinAsmParser::parseOptionalTrailingVersionComponent(
1042
82
    unsigned *Component, const char *ComponentName) {
1043
82
  assert(getLexer().is(AsmToken::Comma) && "comma expected");
1044
82
  Lex();
1045
82
  if (getLexer().isNot(AsmToken::Integer))
1046
3
    return TokError(Twine("invalid ") + ComponentName +
1047
3
                    " version number, integer expected");
1048
79
  int64_t Val = getLexer().getTok().getIntVal();
1049
79
  if (Val > 255 || 
Val < 065
)
1050
14
    return TokError(Twine("invalid ") + ComponentName + " version number");
1051
65
  *Component = Val;
1052
65
  Lex();
1053
65
  return false;
1054
65
}
1055
1056
/// parseVersion ::= parseMajorMinorVersionComponent
1057
///                      parseOptionalTrailingVersionComponent
1058
bool DarwinAsmParser::parseVersion(unsigned *Major, unsigned *Minor,
1059
209
                                   unsigned *Update) {
1060
209
  if (parseMajorMinorVersionComponent(Major, Minor, "OS"))
1061
56
    return true;
1062
153
1063
153
  // Get the update level, if specified
1064
153
  *Update = 0;
1065
153
  if (getLexer().is(AsmToken::EndOfStatement) ||
1066
153
      
isSDKVersionToken(getLexer().getTok())81
)
1067
75
    return false;
1068
78
  if (getLexer().isNot(AsmToken::Comma))
1069
1
    return TokError("invalid OS update specifier, comma expected");
1070
77
  if (parseOptionalTrailingVersionComponent(Update, "OS update"))
1071
15
    return true;
1072
62
  return false;
1073
62
}
1074
1075
15
bool DarwinAsmParser::parseSDKVersion(VersionTuple &SDKVersion) {
1076
15
  assert(isSDKVersionToken(getLexer().getTok()) && "expected sdk_version");
1077
15
  Lex();
1078
15
  unsigned Major, Minor;
1079
15
  if (parseMajorMinorVersionComponent(&Major, &Minor, "SDK"))
1080
7
    return true;
1081
8
  SDKVersion = VersionTuple(Major, Minor);
1082
8
1083
8
  // Get the subminor version, if specified.
1084
8
  if (getLexer().is(AsmToken::Comma)) {
1085
5
    unsigned Subminor;
1086
5
    if (parseOptionalTrailingVersionComponent(&Subminor, "SDK subminor"))
1087
2
      return true;
1088
3
    SDKVersion = VersionTuple(Major, Minor, Subminor);
1089
3
  }
1090
8
  
return false6
;
1091
8
}
1092
1093
void DarwinAsmParser::checkVersion(StringRef Directive, StringRef Arg,
1094
127
                                   SMLoc Loc, Triple::OSType ExpectedOS) {
1095
127
  const Triple &Target = getContext().getObjectFileInfo()->getTargetTriple();
1096
127
  if (Target.getOS() != ExpectedOS)
1097
102
    Warning(Loc, Twine(Directive) +
1098
102
            (Arg.empty() ? 
Twine()92
:
Twine(' ') + Arg10
) +
1099
102
            " used while targeting " + Target.getOSName());
1100
127
1101
127
  if (LastVersionDirective.isValid()) {
1102
54
    Warning(Loc, "overriding previous version directive");
1103
54
    Note(LastVersionDirective, "previous definition is here");
1104
54
  }
1105
127
  LastVersionDirective = Loc;
1106
127
}
1107
1108
108
static Triple::OSType getOSTypeFromMCVM(MCVersionMinType Type) {
1109
108
  switch (Type) {
1110
108
  
case MCVM_WatchOSVersionMin: return Triple::WatchOS14
;
1111
108
  
case MCVM_TvOSVersionMin: return Triple::TvOS14
;
1112
108
  
case MCVM_IOSVersionMin: return Triple::IOS15
;
1113
108
  
case MCVM_OSXVersionMin: return Triple::MacOSX65
;
1114
0
  }
1115
0
  llvm_unreachable("Invalid mc version min type");
1116
0
}
1117
1118
/// parseVersionMin
1119
///   ::= .ios_version_min parseVersion parseSDKVersion
1120
///   |   .macosx_version_min parseVersion parseSDKVersion
1121
///   |   .tvos_version_min parseVersion parseSDKVersion
1122
///   |   .watchos_version_min parseVersion parseSDKVersion
1123
bool DarwinAsmParser::parseVersionMin(StringRef Directive, SMLoc Loc,
1124
171
                                      MCVersionMinType Type) {
1125
171
  unsigned Major;
1126
171
  unsigned Minor;
1127
171
  unsigned Update;
1128
171
  if (parseVersion(&Major, &Minor, &Update))
1129
60
    return true;
1130
111
1131
111
  VersionTuple SDKVersion;
1132
111
  if (isSDKVersionToken(getLexer().getTok()) && 
parseSDKVersion(SDKVersion)4
)
1133
3
    return true;
1134
108
1135
108
  if (parseToken(AsmToken::EndOfStatement))
1136
0
    return addErrorSuffix(Twine(" in '") + Directive + "' directive");
1137
108
1138
108
  Triple::OSType ExpectedOS = getOSTypeFromMCVM(Type);
1139
108
  checkVersion(Directive, StringRef(), Loc, ExpectedOS);
1140
108
  getStreamer().EmitVersionMin(Type, Major, Minor, Update, SDKVersion);
1141
108
  return false;
1142
108
}
1143
1144
19
static Triple::OSType getOSTypeFromPlatform(MachO::PlatformType Type) {
1145
19
  switch (Type) {
1146
19
  
case MachO::PLATFORM_MACOS: return Triple::MacOSX10
;
1147
19
  
case MachO::PLATFORM_IOS: return Triple::IOS2
;
1148
19
  
case MachO::PLATFORM_TVOS: return Triple::TvOS4
;
1149
19
  
case MachO::PLATFORM_WATCHOS: return Triple::WatchOS2
;
1150
19
  
case MachO::PLATFORM_BRIDGEOS: /* silence warning */ break0
;
1151
19
  
case MachO::PLATFORM_MACCATALYST: return Triple::IOS1
;
1152
19
  
case MachO::PLATFORM_IOSSIMULATOR: /* silence warning */ break0
;
1153
19
  
case MachO::PLATFORM_TVOSSIMULATOR: /* silence warning */ break0
;
1154
19
  
case MachO::PLATFORM_WATCHOSSIMULATOR: /* silence warning */ break0
;
1155
0
  }
1156
0
  llvm_unreachable("Invalid mach-o platform type");
1157
0
}
1158
1159
/// parseBuildVersion
1160
///   ::= .build_version (macos|ios|tvos|watchos), parseVersion parseSDKVersion
1161
41
bool DarwinAsmParser::parseBuildVersion(StringRef Directive, SMLoc Loc) {
1162
41
  StringRef PlatformName;
1163
41
  SMLoc PlatformLoc = getTok().getLoc();
1164
41
  if (getParser().parseIdentifier(PlatformName))
1165
1
    return TokError("platform name expected");
1166
40
1167
40
  unsigned Platform = StringSwitch<unsigned>(PlatformName)
1168
40
    .Case("macos", MachO::PLATFORM_MACOS)
1169
40
    .Case("ios", MachO::PLATFORM_IOS)
1170
40
    .Case("tvos", MachO::PLATFORM_TVOS)
1171
40
    .Case("watchos", MachO::PLATFORM_WATCHOS)
1172
40
    .Case("macCatalyst", MachO::PLATFORM_MACCATALYST)
1173
40
    .Default(0);
1174
40
  if (Platform == 0)
1175
1
    return Error(PlatformLoc, "unknown platform name");
1176
39
1177
39
  if (getLexer().isNot(AsmToken::Comma))
1178
1
    return TokError("version number required, comma expected");
1179
38
  Lex();
1180
38
1181
38
  unsigned Major;
1182
38
  unsigned Minor;
1183
38
  unsigned Update;
1184
38
  if (parseVersion(&Major, &Minor, &Update))
1185
12
    return true;
1186
26
1187
26
  VersionTuple SDKVersion;
1188
26
  if (isSDKVersionToken(getLexer().getTok()) && 
parseSDKVersion(SDKVersion)11
)
1189
6
    return true;
1190
20
1191
20
  if (parseToken(AsmToken::EndOfStatement))
1192
1
    return addErrorSuffix(" in '.build_version' directive");
1193
19
1194
19
  Triple::OSType ExpectedOS
1195
19
    = getOSTypeFromPlatform((MachO::PlatformType)Platform);
1196
19
  checkVersion(Directive, PlatformName, Loc, ExpectedOS);
1197
19
  getStreamer().EmitBuildVersion(Platform, Major, Minor, Update, SDKVersion);
1198
19
  return false;
1199
19
}
1200
1201
1202
namespace llvm {
1203
1204
5.25k
MCAsmParserExtension *createDarwinAsmParser() {
1205
5.25k
  return new DarwinAsmParser;
1206
5.25k
}
1207
1208
} // end llvm namespace