diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-12-05 00:29:32 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-12-05 00:29:32 +0000 |
commit | 96a564f2beec8c1930f0640844eec433e03bbce8 (patch) | |
tree | db18bf84800e8860865f55dddd773256547604db /include/llvm/Option/OptSpecifier.h | |
parent | ee47edfd8e2dd048522ebd47305aeefbe9d8729c (diff) |
Copy clang/Driver/<Option parsing stuff> to llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Option/OptSpecifier.h')
-rw-r--r-- | include/llvm/Option/OptSpecifier.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/llvm/Option/OptSpecifier.h b/include/llvm/Option/OptSpecifier.h new file mode 100644 index 0000000000..3bc9bb24ed --- /dev/null +++ b/include/llvm/Option/OptSpecifier.h @@ -0,0 +1,39 @@ +//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_OPTSPECIFIER_H +#define LLVM_SUPPORT_OPTSPECIFIER_H + +namespace llvm { +namespace opt { + class Option; + + /// OptSpecifier - Wrapper class for abstracting references to option IDs. + class OptSpecifier { + unsigned ID; + + private: + explicit OptSpecifier(bool); // DO NOT IMPLEMENT + + public: + OptSpecifier() : ID(0) {} + /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {} + /*implicit*/ OptSpecifier(const Option *Opt); + + bool isValid() const { return ID != 0; } + + unsigned getID() const { return ID; } + + bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); } + bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); } + }; +} +} + +#endif |