microsoft / microsoft/vscode-cpptools

Code analysis should forward `-target` to clang

Open
#11,749 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: Code Analysis Language Service more votes needed quick fix
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Feature Request

I have a codebase for an ARM Cortex M target, in which I use the arm-none-eabi-gcc compiler. I'm using this extension in combination with another extension that uses the API to pass compile commands to the C/C++ extension. This extension passes the compilerPath in both its provideConfigurations and provideBrowseConfiguration hooks.

As far as I can tell, intellisense is able to pick up on this and treat types like size_t as a 32 bit unsigned integer. Code analysis, however does not do this on its own. I can work around this by passing my compiler to clang through the code analysis arguments:

"C_Cpp.codeAnalysis.clangTidy.args": [
  "--extra-arg=--target=arm-none-eabi-gcc"
],

Could the code analysis engine pick up -target from the compilerPath automatically? I assume the same applies to raw compile_commands.json too.

Related to, but separate from #9829.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace how compilerPath is passed through provideConfigurations and provideBrowseConfiguration into code analysis, then compare that path with raw compile_commands.json handling. Confirm that the target is forwarded to clang automatically for both sources, including the ARM Cortex M case, without requiring C_Cpp.codeAnalysis.clangTidy.args.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
compilers, embedded-iot, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.