question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Different behavior with clang-tidy: open local folder with CMakeLists vs. VS sln file generated by cmake

See original GitHub issue

Trying to understand some different behavior running clang-tidy through clang-power-tools on Visual Studio 2022 Community Ed. Running clang-tidy is started by clicking the Tidy icon from the Clang Power Tools.

Quick summary: can’t get clang-tidy to run through VS 2022 when local folder (with CMakeLists.txt) is opened. Works with CMake generated VS Soln file opened with VS 2022.

More details below: Opening the local folder of a very simple CMake project with VS 2022 Comm Ed and attempting to run clang-tidy, selecting the Tidy button, I get the following in the Output tab:

--- CLANG TIDY STARTED ---

At line:1 char:132
+ ... \EXTENSIONS\vfkd2wds.v0j\Tooling\\v1\clang-build.ps1' -proj ) -file ( ...
+                                                                 ~
Unexpected token ')' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
 

--- CLANG TIDY FINISHED ---

and clang-tidy does not run as I would expect.

However, if I use cmake to generate the VS Solution file and open the solution into VS 2022 Comm Ed, clang-tidy runs as I would expect. cmake -G “Visual Studio 17 2022” … In this case, the beginning of the output looks like this:

--- CLANG TIDY STARTED ---

VERBOSE: Current Clang Power Tools VSIX version: 9.1.0.1424
VERBOSE: Loaded assembly C:\Program Files\Microsoft Visual 
Studio\2022\Community\MSBuild\Current\Bin\Microsoft.Build.Utilities.Core.dll
VERBOSE: clang-build.ps1 invocation args: 
....

Not sure what may be causing this different behavior. I’m using

clang power tools version 9.1.0.1424 Visual Studio 2022 Comm Ed Version 17.3.3

the code I’ve been testing this with is very simple: https://github.com/willemsn/clangTestCase

Any thoughts on what may be causing this behavior or if I’m doing something that might be causing this?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gian21391commented, Feb 8, 2023

Hi @mariru27, I can confirm that the fix solves the issue for me.

0reactions
mariru27commented, Feb 14, 2023

Hi,

A release with bugfix for this issue is available in new v2023.2.1 of Clang Power Tools

Thank you for your help

Have a nice day, Marina

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to integrate clang-tidy to CMake and GCC?
I want to integrate clang-tidy to our C and C++, CMake based project which is compiled using a custom GCC toolchain. I've tried...
Read more >
Clang Tidy Code analysis not working with a Workspace file.
Type: Bug I created a simple project with the following layout: MyProject .vs/settings.json MyProject Sample Sources main.cpp CMakeLists.txt ...
Read more >
How to use cmake to generate Visual Studio .sln and .vcxproj
My problem: I try to generate VS .sln and .vcxproj files from existing cmake files using cmake. So i will be able to...
Read more >
More Modern CMake
This will make a build directory ( -B ) if it does not exist, with the source directory defined as -S . CMake...
Read more >
CMakeUserPresets.json
Specifies the path to a CMake cache. This directory should contain an existing CMakeCache.txt file. This key is only supported by the Open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found