<div dir="ltr"><div>For this source code:</div><div>#include <vector><br>std::vector<int> v;</div><div><br></div><div>I run:</div><div>clang-tidy x.cpp -- --driver-mode=cl</div><div><br></div><div>From a command prompt opened with the link:</div><div>Developer Command Prompt for VS2015</div><div><br></div><div>I get this output:</div><div>2 errors generated.<br>Error while processing D:\CMakeTest\src\x.cpp.<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\iosfwd:267:21: error: use of undeclared identifier 'char16_t' [clang-diagnostic-error]<br>        struct char_traits<char16_t><br>                           ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\iosfwd:276:21: error: use of undeclared identifier 'char32_t' [clang-diagnostic-error]<br>        struct char_traits<char32_t><br>                           ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\limits:615:33: error: use of undeclared identifier 'char16_t' [clang-diagnostic-error]<br>template<> class numeric_limits<char16_t><br>                                ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\limits:905:33: error: use of undeclared identifier 'char32_t' [clang-diagnostic-error]<br>template<> class numeric_limits<char32_t><br>                                ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstddef:408:14: error: use of undeclared identifier 'char16_t' [clang-diagnostic-error]<br>        struct hash<char16_t><br>                    ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstddef:414:14: error: use of undeclared identifier 'char32_t' [clang-diagnostic-error]<br>        struct hash<char32_t><br>                    ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring:2623:22: error: use of undeclared identifier 'char16_t' [clang-diagnostic-error]<br>typedef basic_string<char16_t, char_traits<char16_t>, allocator<char16_t> ><br>                     ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring:2623:53: error: expected unqualified-id [clang-diagnostic-error]<br>typedef basic_string<char16_t, char_traits<char16_t>, allocator<char16_t> ><br>                                                    ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring:2625:22: error: use of undeclared identifier 'char32_t' [clang-diagnostic-error]<br>typedef basic_string<char32_t, char_traits<char32_t>, allocator<char32_t> ><br>                     ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstring:2625:53: error: expected unqualified-id [clang-diagnostic-error]<br>typedef basic_string<char32_t, char_traits<char32_t>, allocator<char32_t> ><br>                                                    ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common:231:22: error: use of undeclared identifier 'char16_t' [clang-diagnostic-error]<br>        struct _Is_integral<char16_t><br>                            ^<br>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common:237:22: error: use of undeclared identifier 'char32_t' [clang-diagnostic-error]<br>        struct _Is_integral<char32_t><br>                            ^</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 10:56 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>My exact call to my tool is:</div><div>MyTool.exe main.cpp -- --driver-mode=cl -fms-compatibility -fms-extensions</div><div><br></div><div>I get:</div><div>error : unknown argument: '-fms-compatibility'<br>error : unknown argument: '-fms-extensions'</div><div><br></div><div>And I get the same set of errors from earlier.  Also, if I run it from the command line I get a different set of errors than if I run it from a Visual Studio build.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 4:52 PM, Luke Zarko <span dir="ltr"><<a href="mailto:zarko@google.com" target="_blank">zarko@google.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><span style="font-size:12.8px">I'm in the process of setting up a Windows environment to reproduce/debug this.</span><br></div><div><span style="font-size:12.8px"><br></span></div>Are you adding <span style="font-size:12.8px">--driver-mode=cl first in the arguments list, or are you appending it to the arguments you read in from your compilation database?</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Are you using response files for this compilation?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">What happens if you add "-fms-compatibility" and "-fms-extensions" to the end of the arguments list? (I'd have thought these would be implicit with --driver-mode=cl, but maybe not.)</span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 12:25 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.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">That seems to indicate this function doesn't work for clang-cl yet. Luke, ideas?<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 26, 2015 at 7:45 PM Daniel Dilts <<a href="mailto:diltsman@gmail.com" target="_blank">diltsman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>When I changed to second parameter to "clang-cl.exe" I get an output argument list of {"clang-cl", "--driver-mode=cl", "main.cpp"}.</div><div><br></div><div>When I add that additional driver to the invocation of my tool I still get the same set of errors.</div><div><br></div><div>Tool usage:</div><div>MyTool.exe main.cpp -- --driver-mode=cl</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 23, 2015 at 2:22 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.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">The second parameter is the name of the executable the compiler was "invoked as". This should be "clang-cl.exe" probably.</div><div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 22, 2015 at 11:13 PM Daniel Dilts <<a href="mailto:diltsman@gmail.com" target="_blank">diltsman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I wrote a quick program to play with addTargetAndModeForProgramName, and it appears to not work:</div><div><br></div><div>#include <clang/Tooling/Tooling.h></div><div><br></div><div>int main()<br>{<br>   std::vector<std::string> args{ "clang-cl", "main.cpp" };<br>   clang::tooling::addTargetAndModeForProgramName(args, "i686-pc-windows-msvc18.0.0");<br>   return 0;<br>}</div><div><br></div><div>Any suggestions on what I am doing wrong?  The args variable does not get updated by the function call.</div></div><div dir="ltr"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 22, 2015 at 5:09 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.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">Note that to make writing compiler specific tools simpler, tooling has grown a function  addTargetAndModeForProgramName (where you can hopefully pass clang-cl for it to figure out a windows triple - if this doesn't work, let me know and we'll figure out how to fix that)</div><div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 22, 2015 at 8:00 AM Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">This seems more like failure to prefer Clang's immintrin.h over MSVC's. Getting that to work in right Clang tools is annoying.</p>
<p dir="ltr">Sent from phone</p>
<div class="gmail_quote">On Oct 21, 2015 7:27 PM, "Nico Weber via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You probably need to pass some combination of -fms-compatibility -fms-extensions -fdelayed-template-parsing and a MS abi triple to -target to be able to parse SDK headers. You can try running `clang-cl -c some_file.cc -###` to see which cc1 parameters clang-cl passes by default.<div><br></div><div>Actually, looking at lib/Driver/Tools.cpp, it looks like the driver will use good defaults as long as the triple thinks that isWindowsMSVCEnvironment() is true. Try adding something like "-target x86_64-pc-windows-msvc18.0.0" to your flag, that's probably enough. Alternatively, you could also try passing "--driver-mode=cl " as first parameter, then the tool will behave like clang-cl in general (but it'll expect clang-cl flags, see bin/clang-cl /? for a list. -I and -D should work).</div><div><br></div><div>Nico<br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 21, 2015 at 6:11 PM, Daniel Dilts via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</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>I have a custom tool that uses libTooling.  I am running the tool on Windows.  When I attempt to run the tool over my code I get many errors of the following form:</div><div><br></div><div>2>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vector:6:<br>2>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xmemory:6:<br>2>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xmemory0:1015:<br>2>  In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\intrin.h:24:<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:764:28: error: invalid token in macro parameter list<br>2>  #define _mm256_loadu2_m128(/* float const* */ hiaddr, \<br>2>                             ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:768:29: error: invalid token in macro parameter list<br>2>  #define _mm256_loadu2_m128d(/* double const* */ hiaddr, \<br>2>                              ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:772:29: error: invalid token in macro parameter list<br>2>  #define _mm256_loadu2_m128i(/* __m128i const* */ hiaddr, \<br>2>                              ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:782:29: error: invalid token in macro parameter list<br>2>  #define _mm256_storeu2_m128(/* float* */ hiaddr, /* float* */ loaddr, \<br>2>                              ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:790:30: error: invalid token in macro parameter list<br>2>  #define _mm256_storeu2_m128d(/* double* */ hiaddr, /* double* */ loaddr, \<br>2>                               ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:798:30: error: invalid token in macro parameter list<br>2>  #define _mm256_storeu2_m128i(/* __m128i* */ hiaddr, /* __m128i* */ loaddr, \<br>2>                               ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:1117:25: error: invalid token in macro parameter list<br>2>  #define _mm256_set_m128(/* __m128 */ hi, /* __m128 */ lo) \<br>2>                          ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:1120:26: error: invalid token in macro parameter list<br>2>  #define _mm256_set_m128d(/* __m128d */ hi, /* __m128d */ lo) \<br>2>                           ^<br>2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\immintrin.h:1123:26: error: invalid token in macro parameter list<br>2>  #define _mm256_set_m128i(/* __m128i */ hi, /* __m128i */ lo) \<br>2>                           ^<br>2>  9 errors generated.</div><div><br></div><div>Is there some way to get my tool to handle this gracefully?  My command-line for my tool looks like:</div><div>MyTool.exe -- -IC:/Path/To/Includes -DSOME_MACRO</div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">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>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">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>
</blockquote></div>
</div></div></blockquote></div><br></div></div></blockquote></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>