Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot suppress driver diagnostics #1142

Open
sam-mccall opened this issue May 6, 2022 Discussed in #1135 · 5 comments
Open

Cannot suppress driver diagnostics #1142

sam-mccall opened this issue May 6, 2022 Discussed in #1135 · 5 comments

Comments

@sam-mccall
Copy link
Member

The suppression filter is added after we run the driver, so driver diagnostics (e.g. drv_unknown_argument) cannot be suppressed.

Discussed in #1135

Originally posted by alexcocinda May 2, 2022
I am getting these two errors, but my project builds fine:

Unknown argument: '-forward-unknown-to-host-compiler'                       
[clang: drv_unknown_argument]                                               
───────────────────────────────────────────────────────────
Unsupported option '--generate-code=arch=compute_75,code=[compute_75,sm_75]'
[clang: drv_unsupported_opt]                                                

I tried to disable them with the following .clangd config:

CompileFlags:
  Add:
    - --cuda-path=/usr/local/cuda-11.4
    - --cuda-gpu-arch=sm_75
    - -L/usr/local/cuda-11.4/lib64
    - -I/usr/local/cuda-11.4/include
Diagnostics:
  Suppress:
    - drv_unknown_argument
    - drv_unsupported_opt

I am running on Ubuntu 20.04 with clangd 14.0.0. Am I missing something?

@sam-mccall sam-mccall changed the title Suppressing diagnostics does not work as expected Cannot suppress driver diagnostics May 6, 2022
@cilence
Copy link

cilence commented Aug 11, 2022

I have the same problem

@AtomicVar
Copy link

From clangd/vscode-clangd#327, it said we can suppress these by adding to your .clangd file:

CompileFlags:
  Remove:
    - -forward-unknown-to-host-compiler
    - --generate-code*

@matessd
Copy link

matessd commented Apr 28, 2023

I met the same question because one of my compile_commands.json is generated by gcc -fno-lifetime-dse, which is not supported by clangd. And I also tried to add

CompileFlags:
  Remove: -fno-lifetime-dse

in .clangd but it doesn't work.

Finally, I solved it by creating another .clangd in sub-project directory and adding Remove: -fno-lifetime-dse

So for me, it's because I use If: PathMatch in .clangd to support multiple complie_commands.json, which makes clangd can't deal with arg Remove in root .clangd. If anyone is facing the same situation, you can try this method.

@Thrrreeee
Copy link

I met the same question because one of my compile_commands.json is generated by gcc -fno-lifetime-dse, which is not supported by clangd. And I also tried to add

CompileFlags:
  Remove: -fno-lifetime-dse

in .clangd but it doesn't work.

Finally, I solved it by creating another .clangd in sub-project directory and adding Remove: -fno-lifetime-dse

So for me, it's because I use If: PathMatch in .clangd to support multiple complie_commands.json, which makes clangd can't deal with arg Remove in root .clangd. If anyone is facing the same situation, you can try this method.

I meet with the same question, but I can not find where my .clang is. Could you help me?
My error is as follows:
image

@HighCommander4
Copy link

.clangd is a configuration file you can create in the project's root directory, see https://clangd.llvm.org/config.html#files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants