| 1 | //===- GOFFAsmParser.cpp - GOFF 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/MC/MCParser/MCAsmParserExtension.h" |
| 10 | |
| 11 | using namespace llvm; |
| 12 | |
| 13 | namespace { |
| 14 | |
| 15 | class GOFFAsmParser : public MCAsmParserExtension { |
| 16 | template <bool (GOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)> |
| 17 | void addDirectiveHandler(StringRef Directive) { |
| 18 | MCAsmParser::ExtensionDirectiveHandler Handler = |
| 19 | std::make_pair(this, HandleDirective<GOFFAsmParser, HandlerMethod>); |
| 20 | |
| 21 | getParser().addDirectiveHandler(Directive, Handler); |
| 22 | } |
| 23 | |
| 24 | public: |
| 25 | GOFFAsmParser() = default; |
| 26 | |
| 27 | void Initialize(MCAsmParser &Parser) override { |
| 28 | // Call the base implementation. |
| 29 | this->MCAsmParserExtension::Initialize(Parser); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | } // namespace |
| 34 | |
| 35 | namespace llvm { |
| 36 | |
| 37 | MCAsmParserExtension *createGOFFAsmParser() { return new GOFFAsmParser; } |
| 38 | |
| 39 | } // namespace llvm |
| 40 |