COFFDirectiveParser.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===--- COFFDirectiveParser.h - JITLink coff directive parser --*- C++ -*-===//
  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. // MSVC COFF directive parser
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H
  13. #define LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H
  14. #include "llvm/ADT/Triple.h"
  15. #include "llvm/ExecutionEngine/JITLink/JITLink.h"
  16. #include "llvm/Option/Arg.h"
  17. #include "llvm/Option/ArgList.h"
  18. #include "llvm/Support/CommandLine.h"
  19. #include "llvm/Support/Error.h"
  20. #include "llvm/Support/StringSaver.h"
  21. namespace llvm {
  22. namespace jitlink {
  23. enum {
  24. COFF_OPT_INVALID = 0,
  25. #define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11, _12) COFF_OPT_##ID,
  26. #include "COFFOptions.inc"
  27. #undef OPTION
  28. };
  29. /// Parser for the MSVC specific preprocessor directives.
  30. /// https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-160
  31. class COFFDirectiveParser {
  32. public:
  33. Expected<opt::InputArgList> parse(StringRef Str);
  34. private:
  35. llvm::BumpPtrAllocator bAlloc;
  36. llvm::StringSaver saver{bAlloc};
  37. };
  38. } // end namespace jitlink
  39. } // end namespace llvm
  40. #endif // LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H