<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 22, 2014 at 1:21 PM, VinsonL <span dir="ltr"><<a href="mailto:lwhvinson1990@gmail.com" target="_blank">lwhvinson1990@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am a new learner in Clang and meet an odd bug.<br>
<br>
My code is a simple case:<br>
===================================================<br>
.....<br>
static llvm::cl::OptionCategory MyToolCategory("");<br>
.....<br>
int main(int argc, const char **argv)<br>
{<br>
  CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);<br>
  ClangTool Tool(OptionsParser.getCompilations(),<br>
                 OptionsParser.getSourcePathList());<br>
  tooling::MyFactory Factory;<br>
  Tool.run(newFrontendActionFactory(&Factory));<br>
  return 0;<br>
}<br>
==================================================<br>
<br>
but it report an very odd error when compile with clang++(my llvm&clang's<br>
version is 3.4):<br>
<br>
==================================================<br>
ToolingTutorial.cpp:74:23: error: no matching constructor for initialization<br>
of 'clang::tooling::CommonOptionsParser'<br>
  CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);<br>
                      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:67:3:<br>
note: candidate constructor not<br>
      viable: no known conversion from 'llvm::cl::OptionCategory' to 'const<br>
char *' for 3rd argument<br>
  CommonOptionsParser(int &argc, const char **argv, const char *Overview =<br>
0);<br>
  ^<br>
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:61:7:<br>
note: candidate constructor<br>
      (the implicit move constructor) not viable: requires 1 argument, but 3<br>
were provided<br>
class CommonOptionsParser {<br>
      ^<br>
/home/acsa-amd2/Documents/llvm-3.4/tools/clang/include/clang/Tooling/CommonOptionsParser.h:61:7:<br>
note: candidate constructor<br>
      (the implicit copy constructor) not viable: requires 1 argument, but 3<br>
were provided<br>
1 error generated.<br>
make: *** [ToolingTutorial.o] Error 1<br>
==================================================<br>
<br>
it makes no sense that the constructor is no match and the compiler mistake<br>
'llvm::cl::OptionCategory' for  'const char *' .<br></blockquote><div><br></div><div>It doesn't. The CommonOptionsParser actually takes a const char* as third argument, not a llvm::cl::OptionCategory. At least that's what the error message tells you :)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/an-odd-bug-in-CommonOptionsParser-tp4038552.html" target="_blank">http://clang-developers.42468.n3.nabble.com/an-odd-bug-in-CommonOptionsParser-tp4038552.html</a><br>

Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>