• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CLANG_DRIVER_OPTSPECIFIER_H
11 #define CLANG_DRIVER_OPTSPECIFIER_H
12 
13 namespace clang {
14 namespace driver {
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); // DO NOT IMPLEMENT
23 
24   public:
OptSpecifier()25     OptSpecifier() : ID(0) {}
OptSpecifier(unsigned _ID)26     /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}
27     /*implicit*/ OptSpecifier(const Option *Opt);
28 
isValid()29     bool isValid() const { return ID != 0; }
30 
getID()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