xref: /llvm-project/llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.h (revision 3f092f37b7362447cbb13f5502dae4bdd5762afd)
188181375SSunho Kim //===--- COFFDirectiveParser.h - JITLink coff directive parser --*- C++ -*-===//
288181375SSunho Kim //
388181375SSunho Kim // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
488181375SSunho Kim // See https://llvm.org/LICENSE.txt for license information.
588181375SSunho Kim // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
688181375SSunho Kim //
788181375SSunho Kim //===----------------------------------------------------------------------===//
888181375SSunho Kim //
988181375SSunho Kim // MSVC COFF directive parser
1088181375SSunho Kim //
1188181375SSunho Kim //===----------------------------------------------------------------------===//
1288181375SSunho Kim 
1388181375SSunho Kim #ifndef LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H
1488181375SSunho Kim #define LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H
1588181375SSunho Kim 
1688181375SSunho Kim #include "llvm/ExecutionEngine/JITLink/JITLink.h"
1788181375SSunho Kim #include "llvm/Option/Arg.h"
1888181375SSunho Kim #include "llvm/Option/ArgList.h"
1988181375SSunho Kim #include "llvm/Support/CommandLine.h"
2088181375SSunho Kim #include "llvm/Support/Error.h"
2188181375SSunho Kim #include "llvm/Support/StringSaver.h"
2262c7f035SArchibald Elliott #include "llvm/TargetParser/Triple.h"
2388181375SSunho Kim 
2488181375SSunho Kim namespace llvm {
2588181375SSunho Kim namespace jitlink {
2688181375SSunho Kim 
2788181375SSunho Kim enum {
2888181375SSunho Kim   COFF_OPT_INVALID = 0,
29*3f092f37SJan Svoboda #define OPTION(...) LLVM_MAKE_OPT_ID_WITH_ID_PREFIX(COFF_OPT_, __VA_ARGS__),
3088181375SSunho Kim #include "COFFOptions.inc"
3188181375SSunho Kim #undef OPTION
3288181375SSunho Kim };
3388181375SSunho Kim 
3488181375SSunho Kim /// Parser for the MSVC specific preprocessor directives.
3588181375SSunho Kim /// https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-160
3688181375SSunho Kim class COFFDirectiveParser {
3788181375SSunho Kim public:
38ea75c258SSunho Kim   Expected<opt::InputArgList> parse(StringRef Str);
3988181375SSunho Kim 
4088181375SSunho Kim private:
4188181375SSunho Kim   llvm::BumpPtrAllocator bAlloc;
4288181375SSunho Kim   llvm::StringSaver saver{bAlloc};
4388181375SSunho Kim };
4488181375SSunho Kim 
4588181375SSunho Kim } // end namespace jitlink
4688181375SSunho Kim } // end namespace llvm
4788181375SSunho Kim 
4888181375SSunho Kim #endif // LLVM_EXECUTIONENGINE_JITLINK_COFFDIRECTIVEPARSER_H
49