//===- llvm/Support/CommandLine.h - Command line handler --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class implements a command line argument processor that is useful when
// creating a tool. It provides a simple, minimalistic interface that is easily
// extensible and supports nonlocal (library) command line options.
//
// Note that rather than trying to figure out what this code does, you should
// read the library documentation located in docs/CommandLine.html or looks at
// the many example usages in tools/*/*.cpp
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_COMMANDLINE_H
#define LLVM_SUPPORT_COMMANDLINE_H
#include "llvm/Support/type_traits.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include <cassert>
#include <climits>
#include <cstdarg>
#include <string>
#include <utility>
#include <vector>
namespace llvm {
/// cl Namespace - This namespace contains all of the command line option
/// processing machinery. It is intentionally a short name to make qualified
/// usage concise.
namespace cl {
//===----------------------------------------------------------------------===//
// ParseCommandLineOptions - Command line option processing entry point.
//
void ParseCommandLineOptions(int argc, char **argv,
const char *Overview = 0,
bool ReadResponseFiles = false);
//===----------------------------------------------------------------------===//
// ParseEnvironmentOptions - Environment variable option processing alternate
// entry point.
//
void ParseEnvironmentOptions(const char *progName, const char *envvar,
const char *Overview = 0,
bool ReadResponseFiles = false);
///===---------------------------------------------------------------------===//
/// SetVersionPrinter - Override the default (LLVM specific) version printer
/// used to print out the version when --version is given
/// on the command line. This allows other systems using the
/// CommandLine utilities to print their own version string.
void SetVersionPrinter(void (*func)());
// MarkOptionsChanged - Internal helper function.
void MarkOptionsChanged();
//===----------------------------------------------------------------------===//
// Flags permitted to be passed to command line arguments
//
enum NumOccurrences { // Flags for the number of occurrences allowed
Optional = 0x01, // Zero or One occurrence
ZeroOrMore = 0x02, // Zero or more occurrences allowed
Required = 0x03, // One occurrence required
OneOrMore = 0x04, // One or more occurrences required
// ConsumeAfter - Indicates that this option is fed anything that follows the
// last positional argument required by the application (it is an error if
// there are zero positional arguments, and a ConsumeAfter option is used).