LLVM 24.0.0git
XCOFFAsmParser.cpp
Go to the documentation of this file.
1//===- XCOFFAsmParser.cpp - XCOFF Assembly Parser
2//-----------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
13
14using namespace llvm;
15
16namespace {
17
18class XCOFFAsmParser : public MCAsmParserExtension {
19 MCAsmParser *Parser = nullptr;
20
21 template <bool (XCOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
22 void addDirectiveHandler(StringRef Directive) {
24 std::make_pair(this, HandleDirective<XCOFFAsmParser, HandlerMethod>);
25
26 getParser().addDirectiveHandler(Directive, Handler);
27 }
28
29public:
30 XCOFFAsmParser() = default;
31
32 void Initialize(MCAsmParser &P) override {
33 Parser = &P;
34 // Call the base implementation.
36
37 addDirectiveHandler<&XCOFFAsmParser::ParseDirectiveCSect>(".csect");
38 }
39 bool ParseDirectiveCSect(StringRef, SMLoc);
40};
41
42} // end anonymous namespace
43
44// .csect QualName [, Number ]
45bool XCOFFAsmParser::ParseDirectiveCSect(StringRef, SMLoc) {
46 report_fatal_error("XCOFFAsmParser directive not yet supported!");
47 return false;
48}
49
51 return new XCOFFAsmParser;
52}
#define P(N)
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
Represents a location in source code.
Definition SMLoc.h:22
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI MCAsmParserExtension * createXCOFFAsmParser()
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163