<div dir="ltr"><div>That looks like exactly my problem.  I copied the lib directory so that both paths are valid, and everything works.</div><div><br></div><div>Can anyone suggest how to fix my CMake script so that either the build puts the lib directory in the correct location (relative to my tool) or so that my tool looks for the lib directory where the build puts it?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 12:18 PM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel,<br>
<br>
These are Clang's so-called built-in headers. The intrinsic header<br>
names are the same for MSVC, so if you don't have Clang's headers<br>
available, it will find MSVC's, and Clang can't parse them completely.<br>
<br>
All tools need to ship with the Clang built-in headers, unfortunately.<br>
<br>
<a href="http://clang.llvm.org/docs/LibTooling.html#libtooling-builtin-includes" target="_blank" rel="noreferrer">http://clang.llvm.org/docs/LibTooling.html#libtooling-builtin-includes</a><br>
<br>
- Kim<br>
<div><div class="h5"><br>
On Tue, Nov 10, 2015 at 9:02 PM, Daniel Dilts via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> I have tracked this a little further.  In ToolInvocation::run() I see that<br>
> CC1Args for clang-tidy has "-resource-dir<br>
> D:\WorkingDir\build\MyTool\trunk\llvmbuild\Debug\bin\..\lib\clang\3.8.0",<br>
> which directory exists.  CC1Args for my tool has "-resource-dir<br>
> D:\WorkingDir\build\MyTool\Debug\..\lib\clang\3.8.0", which does not exist.<br>
><br>
> I assume that this difference has something to do with the build system.  My<br>
> CMake file to build my tool looks like this (fragment):<br>
><br>
> set(BUILD_SHARED_LIBS OFF)<br>
> add_subdirectory(${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm<br>
> ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild EXCLUDE_FROM_ALL)<br>
> set(BUILD_SHARED_LIBS ${TMP_BUILD_SHARED_LIBS})<br>
><br>
> include_directories(${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/tools/clang/include<br>
>                     ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/include<br>
><br>
> ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild/tools/clang/include<br>
>                     ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvmbuild/include<br>
><br>
> ${CMAKE_BINARY_DIR}/${CLANG_VERSION}/llvm/utils/unittest/googletest/include<br>
>                     )<br>
><br>
> add_library(Lib${ToolName} SHARED<br>
>             ${ToolSources}<br>
>             ${ToolSourceHeaders}<br>
>             ${ToolIncludeHeaders}<br>
>             )<br>
> add_executable(${ToolName}<br>
>                Source/Main.cpp<br>
>                )<br>
><br>
> target_link_libraries(Lib${ToolName}<br>
>                       clangTooling<br>
>                       )<br>
><br>
><br>
><br>
> On Tue, Nov 10, 2015 at 11:14 AM, Daniel Dilts <<a href="mailto:diltsman@gmail.com">diltsman@gmail.com</a>> wrote:<br>
>><br>
>> The main function for my custom tool looks like this:<br>
>> CommonOptionsParser optionsParser(argc, argv, gMyToolCategory);<br>
>> RefactoringTool tool(optionsParser.getCompilations(),<br>
>> optionsParser.getSourcePathList());<br>
>> MyToolActionFactory factory{tool};<br>
>> auto a = tool.runAndSave(&factory);<br>
>><br>
>> In ClangTool::run(), when I get to the line<br>
>> "assert(!CommandLine.empty());" I see that the CompileCommand and<br>
>> CommandLine variables in my custom tool match those from clang-tidy built<br>
>> from the same source.  The only difference is CommandLine[0], which names my<br>
>> tool rather than clang-tidy.<br>
>><br>
>> What is confusing me is that the behavior of Invocation.run() differs<br>
>> between the two programs.  In clang-tidy it runs perfectly (no warnings, no<br>
>> errors).  In my tool I get a lot of errors of the form:<br>
>> C:\Program Files (x86)\Microsoft Visual Studio<br>
>> 14.0\VC\include\immintrin.h(764,28) :  error:<br>
>>       invalid token in macro parameter list<br>
>> #define _mm256_loadu2_m128(/* float const* */ hiaddr, \<br>
>><br>
>> It seems that there must be something that I am missing when checking to<br>
>> see if my program is executing in a similar manner to clang-tidy.  What<br>
>> other variables, functions, etc. should I check to try to debug my problem?<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" rel="noreferrer">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
><br>
</blockquote></div><br></div></div>