[cfe-dev] Custom tool doesn't parse successfully

Daniel Dilts via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 10 11:14:54 PST 2015


The main function for my custom tool looks like this:
CommonOptionsParser optionsParser(argc, argv, gMyToolCategory);
RefactoringTool tool(optionsParser.getCompilations(),
optionsParser.getSourcePathList());
MyToolActionFactory factory{tool};
auto a = tool.runAndSave(&factory);

In ClangTool::run(), when I get to the line "assert(!CommandLine.empty());"
I see that the CompileCommand and CommandLine variables in my custom tool
match those from clang-tidy built from the same source.  The only
difference is CommandLine[0], which names my tool rather than clang-tidy.

What is confusing me is that the behavior of Invocation.run() differs
between the two programs.  In clang-tidy it runs perfectly (no warnings, no
errors).  In my tool I get a lot of errors of the form:
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\immintrin.h(764,28) :  error:
      invalid token in macro parameter list
#define _mm256_loadu2_m128(/* float const* */ hiaddr, \

It seems that there must be something that I am missing when checking to
see if my program is executing in a similar manner to clang-tidy.  What
other variables, functions, etc. should I check to try to debug my problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151110/cc036056/attachment.html>


More information about the cfe-dev mailing list