1 | //===-- Options.h -----------------------------------------------*- 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 | // This file defines command line options used by llvm-debuginfo-analyzer. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef OPTIONS_H |
14 | #define OPTIONS_H |
15 | |
16 | #include "llvm/DebugInfo/LogicalView/Core/LVLine.h" |
17 | #include "llvm/DebugInfo/LogicalView/Core/LVOptions.h" |
18 | #include "llvm/DebugInfo/LogicalView/Core/LVScope.h" |
19 | #include "llvm/DebugInfo/LogicalView/Core/LVSymbol.h" |
20 | #include "llvm/DebugInfo/LogicalView/Core/LVType.h" |
21 | #include "llvm/Support/CommandLine.h" |
22 | |
23 | namespace llvm { |
24 | namespace logicalview { |
25 | namespace cmdline { |
26 | |
27 | class OffsetParser final : public llvm::cl::parser<unsigned long long> { |
28 | public: |
29 | OffsetParser(llvm::cl::Option &O); |
30 | ~OffsetParser() override; |
31 | |
32 | // Parse an argument representing an offset. Return true on error. |
33 | // If the prefix is 0, the base is octal, if the prefix is 0x or 0X, the |
34 | // base is hexadecimal, otherwise the base is decimal. |
35 | bool parse(llvm::cl::Option &O, StringRef ArgName, StringRef ArgValue, |
36 | unsigned long long &Val); |
37 | }; |
38 | |
39 | typedef llvm::cl::list<unsigned long long, bool, OffsetParser> OffsetOptionList; |
40 | |
41 | extern llvm::cl::OptionCategory AttributeCategory; |
42 | extern llvm::cl::OptionCategory CompareCategory; |
43 | extern llvm::cl::OptionCategory OutputCategory; |
44 | extern llvm::cl::OptionCategory PrintCategory; |
45 | extern llvm::cl::OptionCategory ReportCategory; |
46 | extern llvm::cl::OptionCategory SelectCategory; |
47 | extern llvm::cl::OptionCategory WarningCategory; |
48 | extern llvm::cl::OptionCategory InternalCategory; |
49 | |
50 | extern llvm::cl::list<std::string> InputFilenames; |
51 | extern llvm::cl::opt<std::string> OutputFilename; |
52 | |
53 | extern llvm::cl::list<std::string> SelectPatterns; |
54 | |
55 | extern llvm::cl::list<LVElementKind> SelectElements; |
56 | extern llvm::cl::list<LVLineKind> SelectLines; |
57 | extern llvm::cl::list<LVScopeKind> SelectScopes; |
58 | extern llvm::cl::list<LVSymbolKind> SelectSymbols; |
59 | extern llvm::cl::list<LVTypeKind> SelectTypes; |
60 | extern OffsetOptionList SelectOffsets; |
61 | |
62 | extern llvm::cl::list<LVAttributeKind> AttributeOptions; |
63 | extern llvm::cl::list<LVOutputKind> OutputOptions; |
64 | extern llvm::cl::list<LVPrintKind> PrintOptions; |
65 | extern llvm::cl::list<LVWarningKind> WarningOptions; |
66 | extern llvm::cl::list<LVInternalKind> InternalOptions; |
67 | |
68 | extern llvm::cl::list<LVCompareKind> CompareElements; |
69 | extern llvm::cl::list<LVReportKind> ReportOptions; |
70 | |
71 | extern LVOptions ReaderOptions; |
72 | |
73 | // Perform any additional post parse command line actions. Propagate the |
74 | // values captured by the command line parser, into the generic reader. |
75 | void propagateOptions(); |
76 | |
77 | } // namespace cmdline |
78 | } // namespace logicalview |
79 | } // namespace llvm |
80 | |
81 | #endif // OPTIONS_H |
82 | |