LLVM API Documentation

OptSpecifier.h
Go to the documentation of this file.
00001 //===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_OPTION_OPTSPECIFIER_H
00011 #define LLVM_OPTION_OPTSPECIFIER_H
00012 
00013 #include "llvm/Support/Compiler.h"
00014 
00015 namespace llvm {
00016 namespace opt {
00017   class Option;
00018 
00019   /// OptSpecifier - Wrapper class for abstracting references to option IDs.
00020   class OptSpecifier {
00021     unsigned ID;
00022 
00023   private:
00024     explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION;
00025 
00026   public:
00027     OptSpecifier() : ID(0) {}
00028     /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}
00029     /*implicit*/ OptSpecifier(const Option *Opt);
00030 
00031     bool isValid() const { return ID != 0; }
00032 
00033     unsigned getID() const { return ID; }
00034 
00035     bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
00036     bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
00037   };
00038 }
00039 }
00040 
00041 #endif