]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
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 | ||
970d7e83 LB |
10 | #ifndef LLVM_OPTION_OPTSPECIFIER_H |
11 | #define LLVM_OPTION_OPTSPECIFIER_H | |
223e47cc | 12 | |
1a4d82fc JJ |
13 | #include "llvm/Support/Compiler.h" |
14 | ||
970d7e83 LB |
15 | namespace llvm { |
16 | namespace opt { | |
223e47cc LB |
17 | class Option; |
18 | ||
19 | /// OptSpecifier - Wrapper class for abstracting references to option IDs. | |
20 | class OptSpecifier { | |
21 | unsigned ID; | |
22 | ||
23 | private: | |
970d7e83 | 24 | explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION; |
223e47cc LB |
25 | |
26 | public: | |
27 | OptSpecifier() : ID(0) {} | |
28 | /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {} | |
29 | /*implicit*/ OptSpecifier(const Option *Opt); | |
30 | ||
31 | bool isValid() const { return ID != 0; } | |
32 | ||
33 | unsigned getID() const { return ID; } | |
34 | ||
35 | bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); } | |
36 | bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); } | |
37 | }; | |
38 | } | |
39 | } | |
40 | ||
41 | #endif |