clang-tidy not running

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:
std::vector 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 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.

While I have found that passing the triple to clang-tidy works (clang-tidy x.cpp – -target x86_64-pc-windows-msvc19.0.0 -c x.cpp), I am still curious as to why it didn’t work passing the compiler command-line.

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 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
"C:\Program Files (x86)\LLVM\bin\clang-tidy.exe" t.cpp -- --driver-mode=cl
-c t.cpp -fms-compatibility-version=19

Right, it's probably time to drop that. I'll make next week's snapshot
target msvc-style Windows by default.

It would also be great if clang-tidy figured out from the compilation database argv0 whether to construct clang in clang-cl mode?

That sounds like a great idea.