Clang static analysis under VisualStudio2012

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Clang static analysis under VisualStudio2012

bataliero1234

How to invoke static analysis in VisualStudio 2012? I have installed newest Clang and VisualStudioPlugin form http://llvm.org/builds/ and added --analyze in 'Additional Options' ( Properties->Config Properties->C/C++->Command Line). When I try to compile I get

1>clang-cl.exe : error : unknown argument: '--analyze'

Reply | Threaded
Open this post in threaded view
|

Re: Clang static analysis under VisualStudio2012

Reid Kleckner-3
Unfortunately, no one has done the work necessary to surface analyzer results in Visual Studio yet.


On Tue, Aug 26, 2014 at 2:01 AM, bataliero1234 <[hidden email]> wrote:

How to invoke static analysis in VisualStudio 2012? I have installed newest
Clang and VisualStudioPlugin form http://llvm.org/builds/ and added
--analyze in 'Additional Options' ( Properties->Config
Properties->C/C++->Command Line). When I try to compile I get

1>clang-cl.exe : error : unknown argument: '--analyze'





--
View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-static-analysis-under-VisualStudio2012-tp4041403.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang static analysis under VisualStudio2012

bataliero1234
In reply to this post by bataliero1234
Visual runs clang-cl.exe. Is it possible to force clang-cl to invoke  --analyze argument in clang.exe. ?

>clang.exe --analyze main.c
Works correctly. But when I modify main.c and include "windows.h" I get
>"main.c:2:10: fatal error: 'windows.h' file not found"


I have tried "-Xclang <arg>         Pass <arg> to the clang compiler"
> CL.exe -Xclang --analyze main.c
>error: unknown argument: '--analyze'

but it doesn't help.
Reply | Threaded
Open this post in threaded view
|

Re: Clang static analysis under VisualStudio2012

Jordan Rose
-Xclang is for internal options. I don't have a Windows machine, but I would actually assume that "clang-cl.exe --analyze main.c" still works.

Also CCing Anton, who's done some of the work making sure the analyzer runs on Windows. I'm not sure if he's tried any VS integration, though.

Jordan


On Aug 29, 2014, at 6:37 , bataliero1234 <[hidden email]> wrote:

> Visual runs clang-cl.exe. Is it possible to force clang-cl to invoke
> --analyze argument in clang.exe. ?
>
>> clang.exe --analyze main.c
> Works correctly. But when I modify main.c and include "windows.h" I get
>> "main.c:2:10: fatal error: 'windows.h' file not found"
>
>
> I have tried "-Xclang <arg>         Pass <arg> to the clang compiler"
>> CL.exe -Xclang --analyze main.c
>> error: unknown argument: '--analyze'
>
> but it doesn't help.
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-static-analysis-under-VisualStudio2012-tp4041403p4041456.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang static analysis under VisualStudio2012

Reid Kleckner-3
I added --analyze to clang-cl in r216964, but it just generates .plist files. It doesn't do anything clever or integrate-y.


On Tue, Sep 2, 2014 at 8:53 AM, Jordan Rose <[hidden email]> wrote:
-Xclang is for internal options. I don't have a Windows machine, but I would actually assume that "clang-cl.exe --analyze main.c" still works.

Also CCing Anton, who's done some of the work making sure the analyzer runs on Windows. I'm not sure if he's tried any VS integration, though.

Jordan


On Aug 29, 2014, at 6:37 , bataliero1234 <[hidden email]> wrote:

> Visual runs clang-cl.exe. Is it possible to force clang-cl to invoke
> --analyze argument in clang.exe. ?
>
>> clang.exe --analyze main.c
> Works correctly. But when I modify main.c and include "windows.h" I get
>> "main.c:2:10: fatal error: 'windows.h' file not found"
>
>
> I have tried "-Xclang <arg>         Pass <arg> to the clang compiler"
>> CL.exe -Xclang --analyze main.c
>> error: unknown argument: '--analyze'
>
> but it doesn't help.
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-static-analysis-under-VisualStudio2012-tp4041403p4041456.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang static analysis under VisualStudio2012

Anton Yartsev
In reply to this post by Jordan Rose
Hi,
I only managed to compile/analyze the source that includes 'windows.h'
when invoked the frontend (-cc1 option) and explicitly provided include
paths :

clang -cc1 -I "C:/Win-builds/x86_64-w64-mingw32/include" -I
"C:/Win-builds/include/c++/4.8.2" -I
"C:/Win-builds/include/c++/4.8.2/x86_64-w64-mingw32" -I
"F:/llvm_COMMON/-VS_build-/Debug/lib/clang/3.6.0/include" -analyze main.c

Currently failed to get rid of compilation errors reported from system
headers when tried to compile without the frontend invocation.

> -Xclang is for internal options. I don't have a Windows machine, but I would actually assume that "clang-cl.exe --analyze main.c" still works.
>
> Also CCing Anton, who's done some of the work making sure the analyzer runs on Windows. I'm not sure if he's tried any VS integration, though.
>
> Jordan
>
>
> On Aug 29, 2014, at 6:37 , bataliero1234 <[hidden email]> wrote:
>
>> Visual runs clang-cl.exe. Is it possible to force clang-cl to invoke
>> --analyze argument in clang.exe. ?
>>
>>> clang.exe --analyze main.c
>> Works correctly. But when I modify main.c and include "windows.h" I get
>>> "main.c:2:10: fatal error: 'windows.h' file not found"
>>
>> I have tried "-Xclang <arg>         Pass <arg> to the clang compiler"
>>> CL.exe -Xclang --analyze main.c
>>> error: unknown argument: '--analyze'
>> but it doesn't help.
>>
>>
>>
>> --
>> View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-static-analysis-under-VisualStudio2012-tp4041403p4041456.html
>> Sent from the Clang Developers mailing list archive at Nabble.com.
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


--
Anton

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev