VS2010 Clangification Script

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

VS2010 Clangification Script

Clark Gaebel
Because scan-build only works with gcc-like compilers, MSVC seems
awfully lacking. As such, I wrote a little (~100 LOC) script to scan
VS2010 project files and run the appropriate clang based on the input.

I've attached the script. How can I make it available to the rest of the
world?

Also - code review. How does that work here? Python's cool, but I'm by
no means the best at it.

Thanks,
-Clark

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

clangify.py (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: VS2010 Clangification Script

Chris Hacking
Question (vaguely off-topic, but it reminded me): does Clang build with VS
2010 yet? Last time I tried was a couple months ago, and it got caught up on
several issues. A few were clearly identifiable as preprocessor/compiler
bugs (this was before the RC of 2010; it was still in beta), so I decided
against commenting about it on the clang lists. Since you mention VS2010
though, I thought I'd ask...

Sorry I can't answer the question regarding distribution of the script.

Chris

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Clark Gaebel
Sent: Monday, March 08, 2010 5:56 PM
To: [hidden email]
Subject: [cfe-dev] VS2010 Clangification Script

Because scan-build only works with gcc-like compilers, MSVC seems awfully
lacking. As such, I wrote a little (~100 LOC) script to scan
VS2010 project files and run the appropriate clang based on the input.

I've attached the script. How can I make it available to the rest of the
world?

Also - code review. How does that work here? Python's cool, but I'm by no
means the best at it.

Thanks,
-Clark

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

Re: VS2010 Clangification Script

Clark Gaebel
@ Chris

I tried building it x64, and there were various NULL -> ptr conversion
errors that were fixed trivially. I didn't bother with a rebuild
afterward though since my VS2008 build finished with no errors.

I can't build it x86 because the headers are massively bugged on my
machine. All my VS projects HAVE to be x64 or else I can't use C++
headers AT ALL. I think it should build fine though.

@Overmind

Extensions to common IDEs would be freakin' awesome. Microsoft's code
analysis is pretty good, but it'd be great to have an open source
alternative. The only thing is hooking it into CI scripts might be a bit
of a pain with an IDE extension.

On 09/03/2010 3:14 AM, Chris Hacking wrote:

> Question (vaguely off-topic, but it reminded me): does Clang build with VS
> 2010 yet? Last time I tried was a couple months ago, and it got caught up on
> several issues. A few were clearly identifiable as preprocessor/compiler
> bugs (this was before the RC of 2010; it was still in beta), so I decided
> against commenting about it on the clang lists. Since you mention VS2010
> though, I thought I'd ask...
>
> Sorry I can't answer the question regarding distribution of the script.
>
> Chris
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Clark Gaebel
> Sent: Monday, March 08, 2010 5:56 PM
> To: [hidden email]
> Subject: [cfe-dev] VS2010 Clangification Script
>
> Because scan-build only works with gcc-like compilers, MSVC seems awfully
> lacking. As such, I wrote a little (~100 LOC) script to scan
> VS2010 project files and run the appropriate clang based on the input.
>
> I've attached the script. How can I make it available to the rest of the
> world?
>
> Also - code review. How does that work here? Python's cool, but I'm by no
> means the best at it.
>
> Thanks,
> -Clark
>
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: VS2010 Clangification Script

Ted Kremenek
In reply to this post by Clark Gaebel
Hi Clark,

This is a really nice step.  I'm not super fluent in Python, but I did find the code fairly intuitive.  Some of the spacing between conditionals doesn't seem as tight as I am use to seeing, e.g. the extra lines at line 110, but overall it simple and readable.

The approach is a good first step, and should be useful for small VS projects.  This approach will run into issues if any of the following happen:

(1) Intermediate files are needed to be generated by the build in order to compile other files

(2) Any of the source files take different compiler flags

Both (1) and (2) are the reason scan-build actually interposes itself in a regular build.  That is the the ultimate truth of what the compiler really sees, and that's what's needed for accurately processing source files.

I have little experience with VS these days, and don't know what hooks it has to make it more extensible.  I certainly would like to see more support for the analyzer on Windows, and would be happy to post this script on the clang-analyzer website if you were so kind to provide a brief writeup of how to use it.

Ted

On Mar 8, 2010, at 5:56 PM, Clark Gaebel wrote:

> Because scan-build only works with gcc-like compilers, MSVC seems awfully lacking. As such, I wrote a little (~100 LOC) script to scan VS2010 project files and run the appropriate clang based on the input.
>
> I've attached the script. How can I make it available to the rest of the world?
>
> Also - code review. How does that work here? Python's cool, but I'm by no means the best at it.
>
> Thanks,
> -Clark
> <clangify.py>_______________________________________________
> 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: VS2010 Clangification Script

Clark Gaebel
Attached is my attempt at documentation (should be easily modified to
fit the style of clang.llvm.org) and an updated script for easier
modification.

On 16/03/2010 12:56 AM, Ted Kremenek wrote:

> Hi Clark,
>
> This is a really nice step.  I'm not super fluent in Python, but I did find the code fairly intuitive.  Some of the spacing between conditionals doesn't seem as tight as I am use to seeing, e.g. the extra lines at line 110, but overall it simple and readable.
>
> The approach is a good first step, and should be useful for small VS projects.  This approach will run into issues if any of the following happen:
>
> (1) Intermediate files are needed to be generated by the build in order to compile other files
>
> (2) Any of the source files take different compiler flags
>
> Both (1) and (2) are the reason scan-build actually interposes itself in a regular build.  That is the the ultimate truth of what the compiler really sees, and that's what's needed for accurately processing source files.
>
> I have little experience with VS these days, and don't know what hooks it has to make it more extensible.  I certainly would like to see more support for the analyzer on Windows, and would be happy to post this script on the clang-analyzer website if you were so kind to provide a brief writeup of how to use it.
>
> Ted
>
> On Mar 8, 2010, at 5:56 PM, Clark Gaebel wrote:
>
>> Because scan-build only works with gcc-like compilers, MSVC seems awfully lacking. As such, I wrote a little (~100 LOC) script to scan VS2010 project files and run the appropriate clang based on the input.
>>
>> I've attached the script. How can I make it available to the rest of the world?
>>
>> Also - code review. How does that work here? Python's cool, but I'm by no means the best at it.
>>
>> Thanks,
>> -Clark
>> <clangify.py>_______________________________________________
>> 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

clangify2010.py (4K) Download Attachment
Clangify2010.html (2K) Download Attachment