Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:53

0001 //===- OptionUtils.h - Utilities for command line arguments -----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This header contains utilities for command line arguments.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_DRIVER_OPTIONUTILS_H
0014 #define LLVM_CLANG_DRIVER_OPTIONUTILS_H
0015 
0016 #include "clang/Basic/Diagnostic.h"
0017 #include "clang/Basic/LLVM.h"
0018 #include "llvm/Option/OptSpecifier.h"
0019 
0020 namespace llvm {
0021 
0022 namespace opt {
0023 
0024 class ArgList;
0025 
0026 } // namespace opt
0027 
0028 } // namespace llvm
0029 
0030 namespace clang {
0031 /// Return the value of the last argument as an integer, or a default. If Diags
0032 /// is non-null, emits an error if the argument is given, but non-integral.
0033 int getLastArgIntValue(const llvm::opt::ArgList &Args,
0034                        llvm::opt::OptSpecifier Id, int Default,
0035                        DiagnosticsEngine *Diags = nullptr, unsigned Base = 0);
0036 
0037 inline int getLastArgIntValue(const llvm::opt::ArgList &Args,
0038                               llvm::opt::OptSpecifier Id, int Default,
0039                               DiagnosticsEngine &Diags, unsigned Base = 0) {
0040   return getLastArgIntValue(Args, Id, Default, &Diags, Base);
0041 }
0042 
0043 uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
0044                                llvm::opt::OptSpecifier Id, uint64_t Default,
0045                                DiagnosticsEngine *Diags = nullptr,
0046                                unsigned Base = 0);
0047 
0048 inline uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
0049                                       llvm::opt::OptSpecifier Id,
0050                                       uint64_t Default,
0051                                       DiagnosticsEngine &Diags,
0052                                       unsigned Base = 0) {
0053   return getLastArgUInt64Value(Args, Id, Default, &Diags, Base);
0054 }
0055 
0056 } // namespace clang
0057 
0058 #endif // LLVM_CLANG_DRIVER_OPTIONUTILS_H