This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CODECOMPOSER: How to create custom config for clangd for project

Part Number: CODECOMPOSER

Tool/software:

Hello 
I m working on integrating clang-tidy checks in a project in CCS 20
clangd help shows that a .clangd file can be used to configure options for a certain project

>clangd --help

...

--enable-config                     - Read user and project configuration from YAML files.
                                        Project config is from a .clangd file in the project directory.
                                        User config is from clangd/config.yaml in the following directories:
                                                Windows: %USERPROFILE%\AppData\Local
                                                Mac OS: ~/Library/Preferences/
                                                Others: $XDG_CONFIG_HOME, usually ~/.config

and since .clang-tidy file is not currently spported; i was wondering if it would be possible to convert the clang-tidy format into the .clangd format and make clangd use it for the project

and in the same context, how can i use clangd in CI to generate reports on failed checks ?

in another approach, i tried using C:\ti\ccs2020\ccs\tools\compiler\ti-cgt-armllvm_4.0.3.LTS\bin\tiarmclang-tidy.exe compiler tool with the compile_commands.json file located under <ProjRoot>/<BuildConfig>/.clangd/

the tiarmclang-tidy tool doesn t work with this file 

PS: I have a valid clang-tidy file in project root

>C:\ti\ccs2020\ccs\tools\compiler\ti-cgt-armllvm_4.0.3.LTS\bin\tiarmclang-tidy.exe -p Debug/.clangd gpio_toggle_output.c
Error while processing <ProjPath>\gpio_toggle_output.c.
error: no input files [clang-diagnostic-error]
error: unable to handle compilation, expected exactly one compiler job in '' [clang-diagnostic-error]
Found compiler error(s).

How can we generate a valid compile_commands.json file to use with tiarmclang-tidy; or maybe edit the file generated by clangd somehow to make it compatible

Best 
Radhwen

  • Hello,

    I tried adding a clang-tidy check in the .clangd file but it still does not seem to be getting picked up. It could be related to the limitation regarding the .clang-tidy file. I'll need to discuss with engineering further.

  • Hello Ki,

    If we want to specify the clag-tidy options in project config, how could we achieve the following

    * Remove check from glob
    * Specifying a check option value
      

    ---
    Checks: >
      bugprone-*,
      -bugprone-easily-swappable-parameters,
    CheckOptions:
      - key: bugprone-signed-char-misuse.CharTypdefsToIgnore
        value: int8_t;uint8_t


    in the snippet above, we added all bugprone checks and removed "bugprone-easily-swappable-parameters" check. we also want to assign a specific value to an option for one of the other bugprone checks

    how can we achieve that using code composer?

  • If we want to specify the clag-tidy options in project config, how could we achieve the following

    Again, I don't think this is currently working. We would need to add support for this.