OptSpecifier.h revision a39058aaed4540fc37681cad728b99546595b2e8
1//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLVM_OPTION_OPTSPECIFIER_H 11#define LLVM_OPTION_OPTSPECIFIER_H 12 13namespace llvm { 14namespace opt { 15 class Option; 16 17 /// OptSpecifier - Wrapper class for abstracting references to option IDs. 18 class OptSpecifier { 19 unsigned ID; 20 21 private: 22 explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION; 23 24 public: 25 OptSpecifier() : ID(0) {} 26 /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {} 27 /*implicit*/ OptSpecifier(const Option *Opt); 28 29 bool isValid() const { return ID != 0; } 30 31 unsigned getID() const { return ID; } 32 33 bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); } 34 bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); } 35 }; 36} 37} 38 39#endif 40