clang-power-tools
clang-power-tools copied to clipboard
Support running clang-tidy with compile_commands.json
I'm working on a UE4 project, which doesn't use MSVC or CMake, so pulling compile flags from the project doesn't work. However, I can have UnrealBuildTool spit out a compile_commands.json, which I can use to manually run clang-tidy from the command line. I would love to have this functionality in the extension to point it at a compile_commands.json, and have the extension run clang-tidy -p <path/to/compile_commands.json>
. I'm happy to do this work myself, if someone can give me some tips on how to get started!
Hi @ColdenCullen ,
Thanks for reaching out to us regarding this improvement. It would require some major plumbing work to be done in our PowerShell piping but definitely doable nonetheless.
We would appreciate if you would go into detail regarding how Clang Power Tools would be of help in this scenario, since you can readily pass that JSON compilation database to clang-tidy and have it executed.
Thanks for the info!
The HUGE advantage of Clang Power Tools here is the IDE integration. Seeing warnings and errors in the code, and having the quick fix option is extremely valuable. We're trying to make it easier for our engineers to run clang-tidy on their machines to keep the code clean (and avoid CI breakages or warnings), and the lowest friction way to do that is from inside Visual Studio.
Let me know if there's any more information I can provide, or any work I can get started on!
Would it not be possible to get UnrealBuildTool to generate a vcxproj file instead of a JSON compilation database? That way you could plug directly into Visual Studio, with Clang Power Tools working out of the box.
UnrealBuildTool can generate vcproj/sln-files, but they are "NMake"-based (calling UnrealBuildTool via NMake in project properties), which I guess is not supported by Clang Power Tools (at least all toolbar buttons are grayed out).
I am also interested in Unreal support, and the JSON compile database seems to be a good starting point. Any hints where to start would be appreciated.