<div dir="ltr"><div>I have tracked this a little further.  In ToolInvocation::run() I see that CC1Args for clang-tidy has "-resource-dir D:\WorkingDir\build\MyTool\trunk\llvmbuild\Debug\bin\..\lib\clang\3.8.0", which directory exists.  CC1Args for my tool has "-resource-dir D:\WorkingDir\build\MyTool\Debug\..\lib\clang\3.8.0", which does not exist.</div><div><br></div><div>I assume that this difference has something to do with the build system.  My CMake file to build my tool looks like this (fragment):</div><div><br></div><div>set(BUILD_SHARED_LIBS OFF)<br>add_subdirectory(${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild EXCLUDE_FROM_ALL)<br>set(BUILD_SHARED_LIBS ${TMP_BUILD_SHARED_LIBS})</div><div><br></div><div>include_directories(${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/tools/clang/include<br>                    ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/include<br>                    ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild/tools/clang/include<br>                    ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild/include<br>                    ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/utils/unittest/googletest/include<br>                    )</div><div><br></div><div>add_library(Lib${ToolName} SHARED<br>            ${ToolSources}<br>            ${ToolSourceHeaders}<br>            ${ToolIncludeHeaders}<br>            )<br>add_executable(${ToolName}<br>               Source/Main.cpp<br>               )</div><div><br></div><div>target_link_libraries(Lib${ToolName}<br>                      clangTooling<br>                      )<br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 11:14 AM, Daniel Dilts <span dir="ltr"><<a href="mailto:diltsman@gmail.com" target="_blank">diltsman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The main function for my custom tool looks like this:</div><div>CommonOptionsParser optionsParser(argc, argv, gMyToolCategory);<br>RefactoringTool tool(optionsParser.getCompilations(), optionsParser.getSourcePathList());<br>MyToolActionFactory factory{tool};<br>auto a = tool.runAndSave(&factory);</div><div><br></div><div>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.</div><div><br></div><div>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:</div><div>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h(764,28) :  error:<br>      invalid token in macro parameter list<br>#define _mm256_loadu2_m128(/* float const* */ hiaddr, \</div><div><br></div><div>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?</div></div>
</blockquote></div><br></div>