[cfe-dev] Help with Command-Line Validation
Uri Mann via cfe-dev
cfe-dev at lists.llvm.org
Tue Nov 24 21:41:56 PST 2015
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::cl::basic_parser<std::string> {
//ProjectParser(__in llvm::cl::opt<std::string, false, ProjectParser>& Option);
//ProjectParser& operator=(const ProjectParser&) = delete;
typedef std::string parser_data_type;
typedef llvm::cl::OptionValue<std::string> OptVal;
// parse - Return true on error.
bool parse(__in llvm::cl::Option& option,
__in llvm::StringRef argName,
__in const std::string& argValue,
__in std::string& project);
// Needed to for CLANG 3.7.0
//operator llvm::cl::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::cl::opt<std::string,false,ProjectParser>' to 'const ProjectParser &'
1> Reason: cannot convert from 'llvm::cl::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::cl::opt<std::string,false,ProjectParser>::opt<const char[8],llvm::cl::desc,llvm::cl::NumOccurrencesFlag,llvm::cl::cat>(const char (&)[8],const llvm::cl::desc &,const llvm::cl::NumOccurrencesFlag &,const llvm::cl::cat &)' being compiled
1> C:\<my_path>\CommonFrontendAction.cpp(143) : see reference to function template instantiation 'llvm::cl::opt<std::string,false,ProjectParser>::opt<const char[8],llvm::cl::desc,llvm::cl::NumOccurrencesFlag,llvm::cl::cat>(const char (&)[8],const llvm::cl::desc &,const llvm::cl::NumOccurrencesFlag &,const llvm::cl::cat &)' being compiled
1>C:\<llvm_path>\llvm\include\llvm/Support/CommandLine.h(1026): error C2664: 'void llvm::cl::OptionDiffPrinter<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,ValDT>::print(const llvm::cl::Option &,const llvm::cl::parser<std::string> &,const DT &,const llvm::cl::OptionValue<std::string> &,size_t)' : cannot convert argument 2 from 'const ProjectParser' to 'const llvm::cl::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::cl::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::cl::printOptionDiff<ParserClass,DataType>(const llvm::cl::Option &,const llvm::cl::basic_parser<DataType> &,const ValDT &,const llvm::cl::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::cl::opt<std::string,false,ProjectParser>::printOptionValue(size_t,bool) const'
1> c:\<my_path>\CommonFrontendAction.h(108) : see reference to class template instantiation 'llvm::cl::opt<std::string,false,ProjectParser>' being compiled
1>
1>Build FAILED.
If you're using a different compiler your mileage may differ.
Best,
-Uri
More information about the cfe-dev
mailing list