Clang refactoring tools and clang-cl on Windows

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

Clang refactoring tools and clang-cl on Windows

Hans Wennborg via cfe-dev
Hi cfe-dev,

I'm interested in using the Clang refactoring tools on Windows code. We have a large multi-platform codebase, and while we use Clang to compile a lot of it, we still have quite a bit of Windows-specific code which we compile with MSVC. Initial results refactoring the Clang-compatible code were good, so I'm hopeful I can parse most of the MSVC-specific stuff as well. Is it possible to use clang-cl somehow as the frontend for the refactoring tools? I can get a compilation database with the CL.exe flags pretty easily, but translating that to clang flags across our whole codebase is likely to be challenging. I'm open to modifying the refactoring tools a bit/writing my own tools if that's what it takes.

Thanks!
Liam
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang refactoring tools and clang-cl on Windows

Hans Wennborg via cfe-dev
Some people did a lot of work making both clang-tidy and clang-format easy to use on windows.

clang-tidy


clang-format


Em qui, 15 de fev de 2018 às 06:37, Mitchell, Liam via cfe-dev <[hidden email]> escreveu:
Hi cfe-dev,

I'm interested in using the Clang refactoring tools on Windows code. We have a large multi-platform codebase, and while we use Clang to compile a lot of it, we still have quite a bit of Windows-specific code which we compile with MSVC. Initial results refactoring the Clang-compatible code were good, so I'm hopeful I can parse most of the MSVC-specific stuff as well. Is it possible to use clang-cl somehow as the frontend for the refactoring tools? I can get a compilation database with the CL.exe flags pretty easily, but translating that to clang flags across our whole codebase is likely to be challenging. I'm open to modifying the refactoring tools a bit/writing my own tools if that's what it takes.

Thanks!
Liam
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang refactoring tools and clang-cl on Windows

Hans Wennborg via cfe-dev
In reply to this post by Hans Wennborg via cfe-dev
Hi Liam,

I think this should basically work fine. In Chromium, we've used clang tooling to do various things, and we use cl.exe style flags on Windows. https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tool_refactoring.md has some words on it; https://cs.chromium.org/chromium/src/tools/clang/scripts/run_tool.py?q=run_tool.py&sq=package:chromium&dr=C&l=7 is the run_tool.py that's referenced there.

Under the hood, I believe the way this works is that libTooling looks for either --driver-mode (maybe here? http://llvm-cs.pcc.me.uk/tools/clang/lib/Tooling/Tooling.cpp#178) or for the name of the clang binary in the comp db.

On Thu, Feb 15, 2018 at 12:49 AM, Mitchell, Liam via cfe-dev <[hidden email]> wrote:
Hi cfe-dev,

I'm interested in using the Clang refactoring tools on Windows code. We have a large multi-platform codebase, and while we use Clang to compile a lot of it, we still have quite a bit of Windows-specific code which we compile with MSVC. Initial results refactoring the Clang-compatible code were good, so I'm hopeful I can parse most of the MSVC-specific stuff as well. Is it possible to use clang-cl somehow as the frontend for the refactoring tools? I can get a compilation database with the CL.exe flags pretty easily, but translating that to clang flags across our whole codebase is likely to be challenging. I'm open to modifying the refactoring tools a bit/writing my own tools if that's what it takes.

Thanks!
Liam
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang refactoring tools and clang-cl on Windows

Hans Wennborg via cfe-dev
Well that's good news! Thanks everyone, I'll give that a try.

Liam

From: [hidden email] [mailto:[hidden email]] On Behalf Of Nico Weber
Sent: Friday, February 16, 2018 6:27 AM
To: Mitchell, Liam <[hidden email]>
Cc: [hidden email]
Subject: Re: [cfe-dev] Clang refactoring tools and clang-cl on Windows

Hi Liam,

I think this should basically work fine. In Chromium, we've used clang tooling to do various things, and we use cl.exe style flags on Windows. https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tool_refactoring.md has some words on it; https://cs.chromium.org/chromium/src/tools/clang/scripts/run_tool.py?q=run_tool.py&sq=package:chromium&dr=C&l=7 is the run_tool.py that's referenced there.

Under the hood, I believe the way this works is that libTooling looks for either --driver-mode (maybe here? http://llvm-cs.pcc.me.uk/tools/clang/lib/Tooling/Tooling.cpp#178) or for the name of the clang binary in the comp db.

On Thu, Feb 15, 2018 at 12:49 AM, Mitchell, Liam via cfe-dev <mailto:[hidden email]> wrote:
Hi cfe-dev,

I'm interested in using the Clang refactoring tools on Windows code. We have a large multi-platform codebase, and while we use Clang to compile a lot of it, we still have quite a bit of Windows-specific code which we compile with MSVC. Initial results refactoring the Clang-compatible code were good, so I'm hopeful I can parse most of the MSVC-specific stuff as well. Is it possible to use clang-cl somehow as the frontend for the refactoring tools? I can get a compilation database with the CL.exe flags pretty easily, but translating that to clang flags across our whole codebase is likely to be challenging. I'm open to modifying the refactoring tools a bit/writing my own tools if that's what it takes.

Thanks!
Liam
_______________________________________________
cfe-dev mailing list
mailto:[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev