CommandLine.h revision 5460a1f25d9ddecb5c70667267d66d51af177a99
1//===- CommandLine.h ------------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#ifndef MCLD_COMMANDLINE_H
10#define MCLD_COMMANDLINE_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14#include <llvm/ADT/StringRef.h>
15#include <llvm/Support/CommandLine.h>
16#include "mcld/Support/FileSystem.h"
17#include "mcld/MC/MCLDDirectory.h"
18
19//--------------------------------------------------
20// parser<mcld::sys::fs::Path>
21//
22namespace llvm {
23namespace cl {
24
25template<>
26class parser<mcld::sys::fs::Path> : public basic_parser<mcld::sys::fs::Path>
27{
28public:
29  bool parse(Option &O,
30             StringRef ArgName,
31             StringRef Arg,
32             mcld::sys::fs::Path &Val);
33
34  virtual const char *getValueName() const { return "path"; }
35  void printOptionDiff(const Option &O,
36                       const mcld::sys::fs::Path &V,
37                       OptVal Default,
38                       size_t GlobalWidth) const;
39  virtual void anchor();
40};
41
42//--------------------------------------------------
43// parser<mcld::MCLDDirectory>
44//
45template<>
46class parser<mcld::MCLDDirectory> : public llvm::cl::basic_parser<mcld::MCLDDirectory>
47{
48public:
49  bool parse(Option &O, StringRef ArgName, StringRef Arg, mcld::MCLDDirectory &Val);
50
51  virtual const char *getValueName() const { return "directory"; }
52  void printOptionDiff(const Option &O,
53                       const mcld::MCLDDirectory &V,
54                       OptVal Default,
55                       size_t GlobalWidth) const;
56  virtual void anchor();
57};
58
59} // namespace of cl
60} // namespace of llvm
61
62#endif
63
64