Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:22

0001 //===- OptSpecifier.h - Option Specifiers -----------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_OPTION_OPTSPECIFIER_H
0010 #define LLVM_OPTION_OPTSPECIFIER_H
0011 
0012 namespace llvm {
0013 namespace opt {
0014 
0015 class Option;
0016 
0017 /// OptSpecifier - Wrapper class for abstracting references to option IDs.
0018 class OptSpecifier {
0019   unsigned ID = 0;
0020 
0021 public:
0022   OptSpecifier() = default;
0023   explicit OptSpecifier(bool) = delete;
0024   /*implicit*/ OptSpecifier(unsigned ID) : ID(ID) {}
0025   /*implicit*/ OptSpecifier(const Option *Opt);
0026 
0027   bool isValid() const { return ID != 0; }
0028 
0029   unsigned getID() const { return ID; }
0030 
0031   bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
0032   bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
0033 };
0034 
0035 } // end namespace opt
0036 } // end namespace llvm
0037 
0038 #endif // LLVM_OPTION_OPTSPECIFIER_H