[cfe-dev] [clang-tidy] Using clang-tidy on Windows

Paul Hoad via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 4 04:28:29 PDT 2015


Sorry sorry in advance if this is a newbie question, I'm trying to get
clang-tidy (3.8.0 trunk) working on Windows pointing at the with the Visual
Studio 2015 headers (VC and UCRT)

I'm trying a very simple programme
-------------cut-------
#include <iostream>

void main(int argc,char **argv)
{
   std::cerr << "Hello World" << std::endl;
}
-------------cut-------

clang-tidy will work perfectly until I start include system headers,stl
etc...

I run on the command line (inside cygwin bash shell) with the following.

clang-tidy Stdio.cxx -- -I"c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE" -I"c:/Program Files (x86)/Windows
Kits/10/Include/10.0.10150.0/ucrt"


but I get a load of failures due to clang errors in the system headers.

Can I:

1) parse a switch to clang-tidy to tell it not to complain about headers
outside of my control?
2) avoid this problem in the first place (I get the same if I try to
compile with clang.exe or clang-cl.exe)?
3) am I making an obvious mistake?

-----------------compiler output-----------------
8 warnings and 20 errors generated.
Error while processing D:\buildareas\HEAD\issdev\src\test\tidy\Stdio.cxx.
error: too many errors emitted, stopping now [clang-diagnostic-error]
c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE\vadefs.h:28:33: e
rror: expected ';' after top level declarator [clang-diagnostic-error]
        typedef unsigned __int64  uintptr_t;
                                ^
                                ;
c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE\vadefs.h:127:18:
error: expected identifier or '{' [clang-diagnostic-error]
            enum : bool { __the_value = false };
                 ^
c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE\vadefs.h:133:18:
error: expected identifier or '{' [clang-diagnostic-error]
            enum : bool { __the_value = true };
                 ^
c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE\vadefs.h:139:18:
error: expected identifier or '{' [clang-diagnostic-error]
            enum : bool { __the_value = true };
                 ^
c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/INCLUDE\vcruntime.h:81:1:
 error: C++ requires a type specifier for all declarations
[clang-diagnostic-err
or]
_CRT_BEGIN_C_HEADER
...... more errors cut

Many thanks inadvance

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150904/10746ebb/attachment.html>


More information about the cfe-dev mailing list