Hi Dave;
I'm using VS2013 to compile the code. Here's the output when the additional methods are not added:
// CommonFrontendAction.h
struct ProjectParser : public llvm:
:basic_parser<std::string> {
//ProjectParser(__in llvm:
:opt<std::string, false, ProjectParser>& Option);
//ProjectParser& operator=(const ProjectParser&) = delete;
typedef std::string parser_data_type;
typedef llvm:
:OptionValue<std::string> OptVal;
// parse - Return true on error.
bool parse(__in llvm:
:Option& option,
__in llvm::StringRef argName,
__in const std::string& argValue,
__in std::string& project);
// Needed to for CLANG 3.7.0
//operator llvm:
:parser<std::string>&(void) const;
};
1> CommonFrontendAction.cpp
1>c:\<my_path>\CommonFrontendAction.h(97): warning C4510: 'ProjectParser' : default constructor could not be generated
1> c:\<my_path>\CommonFrontendAction.h(83) : see declaration of 'ProjectParser'
1>c:\<my_path>\CommonFrontendAction.h(97): warning C4610: struct 'ProjectParser' can never be instantiated - user defined constructor required
1>C:\<llvm_path>\llvm\include\llvm/Support/CommandLine.h(1251): error C2664: 'ProjectParser::ProjectParser(const ProjectParser &)' : cannot convert argument 1 from 'llvm:
:opt<std::string,false,ProjectParser>' to 'const ProjectParser &'
1> Reason: cannot convert from 'llvm:
:opt<std::string,false,ProjectParser>' to 'const ProjectParser'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> C:\<my_path>\CommonFrontendAction.cpp(143) : see reference to function template instantiation 'llvm:
:opt<std::string,false,ProjectParser>::opt<const char[8],llvm:
:desc,llvm:
:NumOccurrencesFlag,llvm:
:cat>(const char (&)[8],const llvm:
:desc &,const llvm:
:NumOccurrencesFlag &,const llvm:
:cat &)' being compiled
1> C:\<my_path>\CommonFrontendAction.cpp(143) : see reference to function template instantiation 'llvm:
:opt<std::string,false,ProjectParser>::opt<const char[8],llvm:
:desc,llvm:
:NumOccurrencesFlag,llvm:
:cat>(const char (&)[8],const llvm:
:desc &,const llvm:
:NumOccurrencesFlag &,const llvm:
:cat &)' being compiled
1>C:\<llvm_path>\llvm\include\llvm/Support/CommandLine.h(1026): error C2664: 'void llvm:
:OptionDiffPrinter<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,ValDT>::print(const llvm:
:Option &,const llvm:
:parser<std::string> &,const DT &,const llvm:
:OptionValue<std::string> &,size_t)' : cannot convert argument 2 from 'const ProjectParser' to 'const llvm:
:parser<std::string> &'
1> with
1> [
1> ValDT=std::string
1> , DT=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
1> ]
1> Reason: cannot convert from 'const ProjectParser' to 'const llvm:
:parser<std::string>'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> C:\<llvm_path>\llvm\include\llvm/Support/CommandLine.h(1225) : see reference to function template instantiation 'void llvm:
:printOptionDiff<ParserClass,DataType>(const llvm:
:Option &,const llvm:
:basic_parser<DataType> &,const ValDT &,const llvm:
:OptionValue<std::string> &,size_t)' being compiled
1> with
1> [
1> ParserClass=ProjectParser
1> , DataType=std::string
1> , ValDT=std::string
1> ]
1> C:\<llvm_path>\llvm\include\llvm/Support/CommandLine.h(1222) : while compiling class template member function 'void llvm:
:opt<std::string,false,ProjectParser>::printOptionValue(size_t,bool) const'
1> c:\<my_path>\CommonFrontendAction.h(108) : see reference to class template instantiation 'llvm:
:opt<std::string,false,ProjectParser>' being compiled
1>
1>Build FAILED.
If you're using a different compiler your mileage may differ.
Best,
-Uri