clang 19.0.0git
OptionUtils.h
Go to the documentation of this file.
1//===- OptionUtils.h - Utilities for command line arguments -----*- 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 header contains utilities for command line arguments.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_DRIVER_OPTIONUTILS_H
14#define LLVM_CLANG_DRIVER_OPTIONUTILS_H
15
17#include "clang/Basic/LLVM.h"
18#include "llvm/Option/OptSpecifier.h"
19
20namespace llvm {
21
22namespace opt {
23
24class ArgList;
25
26} // namespace opt
27
28} // namespace llvm
29
30namespace clang {
31/// Return the value of the last argument as an integer, or a default. If Diags
32/// is non-null, emits an error if the argument is given, but non-integral.
33int getLastArgIntValue(const llvm::opt::ArgList &Args,
34 llvm::opt::OptSpecifier Id, int Default,
35 DiagnosticsEngine *Diags = nullptr, unsigned Base = 0);
36
37inline int getLastArgIntValue(const llvm::opt::ArgList &Args,
38 llvm::opt::OptSpecifier Id, int Default,
39 DiagnosticsEngine &Diags, unsigned Base = 0) {
40 return getLastArgIntValue(Args, Id, Default, &Diags, Base);
41}
42
43uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
44 llvm::opt::OptSpecifier Id, uint64_t Default,
45 DiagnosticsEngine *Diags = nullptr,
46 unsigned Base = 0);
47
48inline uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
49 llvm::opt::OptSpecifier Id,
50 uint64_t Default,
51 DiagnosticsEngine &Diags,
52 unsigned Base = 0) {
53 return getLastArgUInt64Value(Args, Id, Default, &Diags, Base);
54}
55
56} // namespace clang
57
58#endif // LLVM_CLANG_DRIVER_OPTIONUTILS_H
Defines the Diagnostic-related interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
uint32_t Id
Definition: SemaARM.cpp:1140
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
The JSON file list parser is used to communicate input to InstallAPI.
uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args, llvm::opt::OptSpecifier Id, uint64_t Default, DiagnosticsEngine *Diags=nullptr, unsigned Base=0)
int getLastArgIntValue(const llvm::opt::ArgList &Args, llvm::opt::OptSpecifier Id, int Default, DiagnosticsEngine *Diags=nullptr, unsigned Base=0)
Return the value of the last argument as an integer, or a default.
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30