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#include <mcld/MC/ZOption.h> 19 20//-------------------------------------------------- 21// parser<mcld::sys::fs::Path> 22// 23namespace llvm { 24namespace cl { 25 26template<> 27class parser<mcld::sys::fs::Path> : public basic_parser<mcld::sys::fs::Path> 28{ 29public: 30 bool parse(Option &O, 31 StringRef ArgName, 32 StringRef Arg, 33 mcld::sys::fs::Path &Val); 34 35 virtual const char *getValueName() const { return "path"; } 36 void printOptionDiff(const Option &O, 37 const mcld::sys::fs::Path &V, 38 OptVal Default, 39 size_t GlobalWidth) const; 40 virtual void anchor(); 41}; 42 43//-------------------------------------------------- 44// parser<mcld::MCLDDirectory> 45// 46template<> 47class parser<mcld::MCLDDirectory> : public llvm::cl::basic_parser<mcld::MCLDDirectory> 48{ 49public: 50 bool parse(Option &O, StringRef ArgName, StringRef Arg, mcld::MCLDDirectory &Val); 51 52 virtual const char *getValueName() const { return "directory"; } 53 void printOptionDiff(const Option &O, 54 const mcld::MCLDDirectory &V, 55 OptVal Default, 56 size_t GlobalWidth) const; 57 virtual void anchor(); 58}; 59 60//-------------------------------------------------- 61// parser<mcld::ZOption> 62// 63template<> 64class parser<mcld::ZOption> : public llvm::cl::basic_parser<mcld::ZOption> 65{ 66public: 67 bool parse(Option &O, StringRef ArgName, StringRef Arg, mcld::ZOption &Val); 68 69 virtual const char *getValueName() const { return "z-option"; } 70 void printOptionDiff(const Option &O, 71 const mcld::ZOption &V, 72 OptVal Default, 73 size_t GlobalWidth) const; 74 virtual void anchor(); 75}; 76 77} // namespace of cl 78} // namespace of llvm 79 80#endif 81 82