[cfe-dev] clang-tidy not running

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 9 16:08:15 PST 2015


This is interesting:
  Default target: i686-pc-windows-gnu

So, Clang thinks it's targetting mingw by default and does a mingw header
file search instead of doing an MSVC header file search. I now recall that
Hans builds the llvm.org releases with an explicit default target of
i686-pc-windows-gnu, so that clang[++].exe behaves like mingw and
clang-cl.exe behaves like cl.exe. clang-tidy inherits the default from
clang, and clang-cl explicitly overrides the default target to MSVC.

I'm not sure we actually want this behavior anymore. These days, I think of
clang-cl as a command line syntax adapter, with clang.exe providing access
to all the same functionality. At least, having the behavior of the
installer differ from that of a stock cmake build feels a bit surprising.

This command line works, as well as the explicit -target override as you
found:
"C:\Program Files (x86)\LLVM\bin\clang-tidy.exe" t.cpp -- --driver-mode=cl
-c t.cpp -fms-compatibility-version=19

On Mon, Nov 9, 2015 at 3:34 PM, Daniel Dilts via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I am trying to get a custom tool to work, but it seems that learning why I
> can't get clang-tidy to work would be a good first step.
>
> I have a file named x.cpp with the following content:
> #include <vector>
> std::vector<int> v;
>
> int Func(int i, int j);
>
>
> I compile it from a Windows command prompt with this:
> clang-cl -c -fms-compatibility-version=19 x.cpp
>
> No errors, warnings, etc. are emitted, and the .obj is created.
>
> I then attempt to run clang-tidy with this:
> clang-tidy x.cpp -- clang-cl -c -fms-compatibility-version=19 x.cpp
>
> This gives me the error:
> error: 'vector' file not found [clang-diagnostic-error]
>
> I installed with the installer built today (November 9th).
> clang-tidy -version
> LLVM (http://llvm.org/):
>   LLVM version 3.8.0-r252455
>   DEBUG build with assertions.
>   Built Nov  9 2015 (04:27:14).
>   Default target: i686-pc-windows-gnu
>   Host CPU: sandybridge
>
> Does anyone know what I missed?  I thought that the arguments after '--'
> could be used instead of a compilation database.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151109/ff9b0e25/attachment.html>


More information about the cfe-dev mailing list