]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/include/llvm/Option/OptSpecifier.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / include / llvm / Option / OptSpecifier.h
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
13 namespace llvm {
14 namespace 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