LLVM 19.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 MCAsmLexer *Lexer = nullptr;
21
22 template <bool (XCOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
23 void addDirectiveHandler(StringRef Directive) {
25 std::make_pair(this, HandleDirective<XCOFFAsmParser, HandlerMethod>);
26
28 }
29
30public:
31 XCOFFAsmParser() = default;
32
33 void Initialize(MCAsmParser &P) override {
34 Parser = &P;
35 Lexer = &Parser->getLexer();
36 // Call the base implementation.
38
39 addDirectiveHandler<&XCOFFAsmParser::ParseDirectiveCSect>(".csect");
40 }
41 bool ParseDirectiveCSect(StringRef, SMLoc);
42};
43
44} // end anonymous namespace
45
46namespace llvm {
47
48MCAsmParserExtension *createXCOFFAsmParser() { return new XCOFFAsmParser; }
49
50} // end namespace llvm
51
52// .csect QualName [, Number ]
53bool XCOFFAsmParser::ParseDirectiveCSect(StringRef, SMLoc) {
54 report_fatal_error("XCOFFAsmParser directive not yet supported!");
55 return false;
56}
#define P(N)
Generic assembler lexer interface, for use by target specific assembly lexers.
Definition: MCAsmLexer.h:37
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.
Generic assembler parser interface, for use by target specific assembly parsers.
Definition: MCAsmParser.h:123
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
Definition: MCAsmParser.h:127
virtual MCAsmLexer & getLexer()=0
virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler)=0
Represents a location in source code.
Definition: SMLoc.h:23
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCAsmParserExtension * createXCOFFAsmParser()
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:156