GOFFAsmParser.cpp 1.1 KB

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