Path: blob/main/contrib/llvm-project/llvm/lib/MC/MCParser/XCOFFAsmParser.cpp
35294 views
//===- XCOFFAsmParser.cpp - XCOFF Assembly Parser1//-----------------------------===//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-exception6//7//===----------------------------------------------------------------------===//89#include "llvm/BinaryFormat/XCOFF.h"10#include "llvm/MC/MCParser/MCAsmParser.h"11#include "llvm/MC/MCParser/MCAsmParserExtension.h"1213using namespace llvm;1415namespace {1617class XCOFFAsmParser : public MCAsmParserExtension {18MCAsmParser *Parser = nullptr;19MCAsmLexer *Lexer = nullptr;2021template <bool (XCOFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>22void addDirectiveHandler(StringRef Directive) {23MCAsmParser::ExtensionDirectiveHandler Handler =24std::make_pair(this, HandleDirective<XCOFFAsmParser, HandlerMethod>);2526getParser().addDirectiveHandler(Directive, Handler);27}2829public:30XCOFFAsmParser() = default;3132void Initialize(MCAsmParser &P) override {33Parser = &P;34Lexer = &Parser->getLexer();35// Call the base implementation.36MCAsmParserExtension::Initialize(*Parser);3738addDirectiveHandler<&XCOFFAsmParser::ParseDirectiveCSect>(".csect");39}40bool ParseDirectiveCSect(StringRef, SMLoc);41};4243} // end anonymous namespace4445namespace llvm {4647MCAsmParserExtension *createXCOFFAsmParser() { return new XCOFFAsmParser; }4849} // end namespace llvm5051// .csect QualName [, Number ]52bool XCOFFAsmParser::ParseDirectiveCSect(StringRef, SMLoc) {53report_fatal_error("XCOFFAsmParser directive not yet supported!");54return false;55}565758