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
23namespace llvm {
24namespace logicalview {
25namespace cmdline {
26
27class OffsetParser final : public llvm::cl::parser<unsigned long long> {
28public:
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
39typedef llvm::cl::list<unsigned long long, bool, OffsetParser> OffsetOptionList;
40
41extern llvm::cl::OptionCategory AttributeCategory;
42extern llvm::cl::OptionCategory CompareCategory;
43extern llvm::cl::OptionCategory OutputCategory;
44extern llvm::cl::OptionCategory PrintCategory;
45extern llvm::cl::OptionCategory ReportCategory;
46extern llvm::cl::OptionCategory SelectCategory;
47extern llvm::cl::OptionCategory WarningCategory;
48extern llvm::cl::OptionCategory InternalCategory;
49
50extern llvm::cl::list<std::string> InputFilenames;
51extern llvm::cl::opt<std::string> OutputFilename;
52
53extern llvm::cl::list<std::string> SelectPatterns;
54
55extern llvm::cl::list<LVElementKind> SelectElements;
56extern llvm::cl::list<LVLineKind> SelectLines;
57extern llvm::cl::list<LVScopeKind> SelectScopes;
58extern llvm::cl::list<LVSymbolKind> SelectSymbols;
59extern llvm::cl::list<LVTypeKind> SelectTypes;
60extern OffsetOptionList SelectOffsets;
61
62extern llvm::cl::list<LVAttributeKind> AttributeOptions;
63extern llvm::cl::list<LVOutputKind> OutputOptions;
64extern llvm::cl::list<LVPrintKind> PrintOptions;
65extern llvm::cl::list<LVWarningKind> WarningOptions;
66extern llvm::cl::list<LVInternalKind> InternalOptions;
67
68extern llvm::cl::list<LVCompareKind> CompareElements;
69extern llvm::cl::list<LVReportKind> ReportOptions;
70
71extern 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.
75void propagateOptions();
76
77} // namespace cmdline
78} // namespace logicalview
79} // namespace llvm
80
81#endif // OPTIONS_H
82