OptSpecifier.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef LLVM_OPTION_OPTSPECIFIER_H
  10. #define LLVM_OPTION_OPTSPECIFIER_H
  11. #include "llvm/Support/Compiler.h"
  12. namespace llvm {
  13. namespace opt {
  14. class Option;
  15. /// OptSpecifier - Wrapper class for abstracting references to option IDs.
  16. class OptSpecifier {
  17. unsigned ID;
  18. private:
  19. explicit OptSpecifier(bool) = delete;
  20. public:
  21. OptSpecifier() : ID(0) {}
  22. /*implicit*/ OptSpecifier(unsigned ID) : ID(ID) {}
  23. /*implicit*/ OptSpecifier(const Option *Opt);
  24. bool isValid() const { return ID != 0; }
  25. unsigned getID() const { return ID; }
  26. bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
  27. bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
  28. };
  29. }
  30. }
  31. #endif