clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
623 stars 102 forks source link

-Wformat does not trigger with wrong `printf` formats #419

Open palapapa opened 1 year ago

palapapa commented 1 year ago

-Wformat does not trigger with very obviously wrong printf formats. Like printf("", 1);

Logs

V[16:56:52.813] <<< {"id":865,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///d%3A/Desktop/C/College/Vending%20Machine/411410040.c"}}}

I[16:56:52.813] <-- textDocument/semanticTokens/full(865)
V[16:56:52.813] ASTWorker running SemanticHighlights on version 1 of d:\Desktop\C\College\Vending Machine\411410040.c
V[16:56:52.813] <<< {"id":866,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///d%3A/Desktop/C/College/Simple%20Base%20Conversion/SimpleBaseConversion.c"}}}

I[16:56:52.813] <-- textDocument/semanticTokens/full(866)
V[16:56:52.813] ASTWorker running SemanticHighlights on version 420 of d:\Desktop\C\College\Simple Base Conversion\SimpleBaseConversion.c
I[16:56:52.813] --> reply:textDocument/semanticTokens/full(866) 0 ms
V[16:56:52.813] >>> {"id":866,"jsonrpc":"2.0","result":{"data":[2,4,4,3,8193,2,9,5,1,1025,1,11,5,3,8192,0,6,5,1,1024,0,11,5,19,8192,0,10,4,19,8192,2,12,5,1,1024,4,21,3,1,1025,1,12,5,1,1024,0,19,5,1,1024,2,12,6,3,4096,0,7,5,1,1024,0,18,3,1,1024,1,12,6,3,4096,0,15,3,1,1024,4,12,6,3,4096,0,7,5,1,1024,0,14,3,1,1024,1,12,6,3,4096,0,17,3,1,1024],"resultId":"184"}}

I[16:56:52.813] --> textDocument/clangd.fileStatus
V[16:56:52.813] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///d:/Desktop/C/College/Simple%20Base%20Conversion/SimpleBaseConversion.c"}}

I[16:56:52.814] --> reply:textDocument/semanticTokens/full(865) 0 ms
V[16:56:52.814] >>> {"id":865,"jsonrpc":"2.0","result":{"data":[9,15,6,8,8193,0,7,6,8,4097,6,0,6,8,4096,0,8,10,3,8193,0,11,6,18,4096,0,7,11,2,1025,0,13,6,18,4096,0,7,8,2,1025,4,5,13,3,8193,0,20,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,18,3,8193,0,25,6,8,4096,0,8,6,2,1033,5,0,6,18,4096,0,7,21,3,8193,0,28,6,8,4096,0,8,6,2,1033,6,0,4,19,8192,0,5,15,3,8193,0,16,6,8,4096,0,8,6,2,1025,0,20,5,2,1033,5,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,7,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,0,17,5,2,1033,6,0,4,19,8192,0,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,6,6,9,3,8193,0,16,6,8,4096,0,8,6,2,1033,0,8,6,18,4096,0,7,3,2,1025,5,6,15,3,8193,0,22,6,8,4096,0,8,6,2,1033,5,6,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,5,0,6,8,4096,0,8,11,3,8193,0,18,6,8,4096,0,8,4,2,1033,6,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,3,2,1033,0,11,6,8,4096,0,8,3,2,1033,4,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,5,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,6,2,1033,5,0,4,19,8192,0,5,18,3,8193,0,19,6,8,4096,0,8,6,2,1025,7,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,4,2,1025,6,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,8,2,1025,4,0,6,8,4096,0,8,7,3,8193,6,5,13,3,8193,0,20,6,8,4096,0,8,3,2,1033,0,5,6,18,4096,0,7,3,2,1025,12,0,6,8,4096,0,8,8,3,8193,0,15,6,8,4096,0,8,3,2,1033,2,4,4,3,8193,5,7,6,8,8193,2,4,6,18,4096,0,7,4,6,2049,1,4,6,18,4096,0,7,8,6,2049,1,4,6,18,4096,0,7,11,6,2049,1,10,4,6,2049,3,0,6,8,4096,0,8,10,3,8193,0,11,6,18,4096,0,7,11,2,1025,0,13,6,18,4096,0,7,8,2,1025,2,8,11,2,1024,2,15,4,19,8192,2,4,6,8,4096,0,8,9,1,1025,0,12,6,3,8192,0,14,6,8,4096,1,9,9,1,1024,2,15,4,19,8192,2,4,9,1,1024,0,11,4,6,2048,1,4,9,1,1024,0,11,8,6,2048,0,11,8,2,1024,1,4,9,1,1024,0,11,11,6,2048,0,14,11,2,1024,1,8,8,2,1024,2,8,9,1,1024,0,11,4,6,2048,0,7,6,3,8192,0,7,8,2,1024,0,10,11,2,1024,1,13,9,1,1024,0,11,4,6,2048,2,12,4,3,8192,0,5,9,1,1024,1,19,4,19,8192,5,8,9,1,1024,0,11,4,6,2048,0,7,4,19,8192,2,11,9,1,1024,3,5,13,3,8193,0,20,6,8,4096,0,8,6,2,1033,2,4,4,3,8192,0,5,6,2,1032,0,8,4,6,2048,1,4,4,3,8192,0,14,9,18,4096,0,10,6,2,1032,3,0,6,18,4096,0,7,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,4,6,2048,3,0,6,18,4096,0,7,18,3,8193,0,25,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,8,6,2048,3,0,6,18,4096,0,7,21,3,8193,0,28,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,11,6,2048,3,0,4,19,8192,0,5,15,3,8193,0,16,6,8,4096,0,8,6,2,1025,0,20,5,2,1033,2,9,13,3,8192,0,14,6,2,1024,0,8,6,2,1024,0,8,4,6,2048,0,6,5,2,1032,2,15,5,19,8192,2,11,4,19,8192,3,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,2,9,12,3,8192,0,13,6,2,1024,0,8,6,2,1024,0,8,4,6,2048,2,15,5,19,8192,2,11,4,19,8192,3,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,0,17,5,2,1033,2,8,3,2,1024,0,6,6,2,1024,0,8,4,6,2048,0,9,5,2,1032,2,15,5,19,8192,2,8,6,2,1024,0,8,4,6,2048,0,8,6,2,1024,0,8,8,6,2048,2,8,6,18,4096,0,7,14,1,1025,1,12,6,2,1024,0,8,8,6,2048,2,12,14,1,1024,0,17,6,2,1024,0,8,8,6,2048,2,13,14,3,8192,0,15,6,2,1024,0,8,14,1,1024,2,19,5,19,8192,3,4,7,3,8192,0,16,6,2,1024,0,8,4,6,2048,0,8,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,0,21,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,14,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,7,6,2,1024,0,8,11,6,2048,1,4,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,13,5,2,1032,0,7,6,2,1024,0,8,11,6,2048,1,4,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,0,4,19,8192,0,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,3,2,1025,2,8,3,2,1024,0,7,6,2,1024,0,8,4,6,2048,2,15,5,19,8192,2,4,7,3,8192,0,16,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1024,0,8,11,6,2048,0,21,6,2,1024,0,8,4,6,2048,0,8,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,0,14,6,2,1024,0,8,4,6,2048,0,7,3,2,1024,0,11,6,2,1024,0,8,11,6,2048,1,4,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,6,9,3,8193,0,16,6,8,4096,0,8,6,2,1033,0,8,6,18,4096,0,7,3,2,1025,2,8,3,2,1024,0,7,6,2,1032,0,8,4,6,2048,0,9,6,2,1032,0,8,4,6,2048,0,8,6,2,1032,0,8,4,6,2048,2,15,4,19,8192,2,19,6,2,1032,0,8,4,6,2048,0,7,3,2,1024,0,6,6,2,1032,0,8,11,6,2048,3,6,15,3,8193,0,22,6,8,4096,0,8,6,2,1033,2,11,9,3,8192,0,10,6,2,1032,0,8,6,2,1032,0,8,4,6,2048,3,6,14,3,8193,0,21,6,8,4096,0,8,6,2,1033,2,11,9,3,8192,0,10,6,2,1032,3,0,6,8,4096,0,8,11,3,8193,0,18,6,8,4096,0,8,4,2,1033,2,4,6,8,4096,0,8,4,1,1025,0,7,10,3,8192,0,11,4,2,1032,0,6,11,6,2048,1,9,4,1,1024,2,15,4,19,8192,2,4,4,1,1024,0,6,4,6,2048,0,7,4,2,1032,0,6,4,6,2048,1,4,4,1,1024,0,6,8,6,2048,0,11,4,2,1032,0,6,8,6,2048,1,8,4,1,1024,0,6,8,6,2048,2,8,4,1,1024,0,6,4,6,2048,0,7,4,19,8192,1,15,4,1,1024,2,10,10,1,1025,0,13,6,3,8192,0,7,4,2,1032,0,6,8,6,2048,0,11,4,2,1032,0,6,11,6,2048,1,9,10,1,1024,2,8,13,3,8192,0,14,4,1,1024,1,15,4,19,8192,2,4,6,3,8192,0,7,10,1,1024,0,12,4,2,1032,0,6,4,6,2048,0,6,4,2,1032,0,6,8,6,2048,0,11,4,2,1032,0,6,11,6,2048,1,4,4,1,1024,0,6,4,6,2048,0,7,10,1,1024,1,11,4,1,1024,3,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,3,2,1033,0,11,6,8,4096,0,8,3,2,1033,2,9,3,2,1032,0,8,3,2,1032,0,7,3,2,1032,0,5,4,6,2048,0,8,3,2,1032,0,5,4,6,2048,0,8,3,2,1032,0,5,11,6,2048,0,15,3,2,1032,0,5,11,6,2048,2,15,5,19,8192,2,8,6,3,8192,0,7,3,2,1032,0,5,4,6,2048,0,6,3,2,1032,0,5,4,6,2048,0,6,3,2,1032,0,5,4,6,2048,0,7,3,2,1032,0,5,11,6,2048,2,15,4,19,8192,4,15,5,19,8192,4,5,12,3,8193,0,13,6,8,4096,0,8,6,2,1025,2,4,6,2,1024,0,8,4,6,2048,3,0,4,19,8192,0,5,12,3,8193,0,19,6,8,4096,0,8,6,2,1033,2,11,6,2,1032,0,8,4,6,2048,3,0,4,19,8192,0,5,18,3,8193,0,19,6,8,4096,0,8,6,2,1025,2,8,6,2,1024,0,8,4,6,2048,2,8,4,3,8192,0,5,6,2,1024,0,8,4,6,2048,1,8,6,2,1024,0,8,4,6,2048,0,7,4,19,8192,1,15,4,19,8192,2,10,7,1,1025,0,10,7,3,8192,0,8,6,2,1024,0,8,4,6,2048,0,6,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,11,6,2048,1,9,7,1,1024,2,15,5,19,8192,2,4,6,2,1024,0,8,4,6,2048,0,7,7,1,1024,1,4,6,2,1024,0,8,8,6,2048,0,11,6,2,1024,0,8,4,6,2048,1,11,4,19,8192,3,0,4,19,8192,0,5,13,3,8193,0,14,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,4,2,1025,2,8,4,2,1024,0,7,6,2,1024,0,8,4,6,2048,2,12,4,2,1024,0,8,6,2,1024,0,8,8,6,2048,2,12,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,4,6,2048,0,7,6,2,1024,0,8,11,6,2048,0,17,4,2,1024,0,7,6,2,1024,0,8,4,6,2048,0,8,6,2,1024,0,8,11,6,2048,1,12,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,19,4,19,8192,4,12,6,18,4096,0,7,11,1,1025,1,19,11,1,1024,0,14,4,2,1024,2,16,11,1,1024,2,17,14,3,8192,0,15,6,2,1024,0,8,11,1,1024,2,23,5,19,8192,2,12,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,19,4,19,8192,5,8,6,2,1024,0,8,4,6,2048,0,7,4,2,1024,1,15,4,19,8192,4,0,4,19,8192,0,5,14,3,8193,0,15,6,8,4096,0,8,6,2,1025,0,8,6,18,4096,0,7,8,2,1025,2,8,8,2,1024,0,12,6,2,1024,0,8,8,6,2048,2,15,4,19,8192,4,14,7,1,1025,0,10,7,3,8192,0,8,6,2,1024,0,8,4,6,2048,0,6,8,2,1024,0,11,6,2,1024,0,8,11,6,2048,1,13,7,1,1024,2,19,5,19,8192,2,8,6,2,1024,0,8,4,6,2048,0,7,7,1,1024,1,8,6,18,4096,0,7,11,1,1025,0,14,6,2,1024,0,8,8,6,2048,1,8,6,2,1024,0,8,8,6,2048,0,11,8,2,1024,1,8,6,3,8192,0,15,6,2,1024,0,8,4,6,2048,0,7,11,1,1024,0,14,6,2,1024,0,8,11,6,2048,0,17,6,2,1024,0,8,8,6,2048,0,11,11,1,1024,0,15,6,2,1024,0,8,11,6,2048,1,15,4,19,8192,4,0,6,8,4096,0,8,7,3,8193,2,4,6,8,4096,0,8,6,1,1025,0,9,10,3,8192,1,8,1,1,1025,1,12,1,1,1024,0,4,7,3,8192,0,14,3,19,8192,0,7,1,1,1024,2,13,5,1,1025,0,14,1,1,1024,1,8,15,3,8192,0,16,6,1,1024,0,9,5,1,1024,2,11,6,1,1024,3,5,13,3,8193,0,20,6,8,4096,0,8,3,2,1033,0,5,6,18,4096,0,7,3,2,1025,2,20,9,3,8192,0,10,3,2,1032,0,5,3,2,1024,3,0,6,8,4096,0,8,8,3,8193,0,15,6,8,4096,0,8,3,2,1033,2,4,6,8,4096,0,8,6,1,1025,0,9,10,3,8192,0,18,6,8,4096,1,4,6,18,4096,0,7,9,1,1025,0,12,14,3,8192,0,15,3,2,1032,1,9,6,18,4096,0,7,1,1,1025,0,7,1,1,1024,0,4,9,1,1024,0,11,1,1,1024,2,12,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,6,16,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,20,1,1,1024,0,5,9,1,1024,4,16,6,18,4096,0,7,13,1,1025,0,16,9,1,1024,1,21,6,18,4096,0,7,1,1,1025,0,4,1,1,1024,0,7,1,1,1024,0,4,9,1,1024,0,11,1,1,1024,2,24,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,24,13,1,1024,0,16,1,1,1024,4,16,6,18,4096,0,7,10,1,1025,0,13,1,1,1024,0,7,8,1,1025,0,11,13,1,1024,1,16,4,19,8192,0,5,12,1,1025,0,15,5,19,8192,1,24,10,1,1024,0,13,13,1,1024,0,15,10,1,1024,2,25,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,10,1,1024,4,24,10,1,1024,0,14,13,1,1024,2,24,12,1,1024,0,15,4,19,8192,4,20,12,1,1024,2,20,1,1,1024,0,4,13,1,1024,3,23,8,1,1024,0,11,1,1,1024,0,3,8,1,1024,2,25,7,3,8192,0,8,13,3,8192,0,14,3,2,1032,0,5,8,1,1024,5,16,6,8,4096,0,8,5,1,1025,0,8,10,3,8192,0,25,10,1,1024,0,13,8,1,1024,1,21,6,18,4096,0,7,1,1,1025,0,4,10,1,1024,0,12,1,1,1024,0,5,8,1,1024,0,10,1,1,1024,2,20,15,3,8192,0,16,5,1,1024,0,15,13,3,8192,0,14,3,2,1032,0,5,1,1,1024,2,16,15,3,8192,0,16,6,1,1024,0,8,5,1,1024,4,11,6,1,1024],"resultId":"100"}}

I[16:56:52.814] --> textDocument/clangd.fileStatus
V[16:56:52.814] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///d:/Desktop/C/College/Vending%20Machine/411410040.c"}}

System information Clangd version (from the log, or clangd --version): 15.0.3 clangd extension version: 0.1.23 Operating system: Windows 10

cacosub7 commented 1 year ago

i'm using vscode-clangd in remote linux, same issue as you posted. Moreover, Errors in the following came up periodically. image

Clangd version (from the log, or clangd --version): 16.0.0 clangd extension version: 0.1.23 Operating system: centos 2.6

HighCommander4 commented 1 year ago

Could you attach complete logs please (the snippet you posted does not contain, for example, the textDocument/publishDiagnostics message), as well as the source file you have open?

palapapa commented 1 year ago

@HighCommand Log.txt

As for the source file, a file with only the main function and printf("", 1); causes this issue, too.

HighCommander4 commented 1 year ago

I'm seeing a lot of diagnostics in the system headers, including ones like this:

V[17:43:51.062] Dropped diagnostic: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/include\stdio.h: 'format' attribute argument not supported: gnu_printf

I wonder if perhaps these indicate that clangd is not parsing your system headers correctly, and this is what leads to its inability to issue warnings like -Wformat.

I notice also the following in the log:

I[17:43:47.105] Failed to find compilation database for d:\Desktop\C\College\Vending Machine\Test.c I[17:43:47.105] ASTWorker building file d:\Desktop\C\College\Vending Machine\Test.c version 2 with command clangd fallback [d:\Desktop\C\College\Vending Machine] "C:\TDM-GCC-64\bin\clang" -Weverything -Wno-used-but-marked-unused -Wno-declaration-after-statement -Wno-vla -Wno-missing-prototypes -IC:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/include -IC:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../include -IC:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/include-fixed -IC:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/include -nostdinc -target x86_64-pc-windows-gnu "-resource-dir=c:\Users\User\AppData\Roaming\Code\User\globalStorage\llvm-vs-code-extensions.vscode-clangd\install\15.0.3\clangd_15.0.3\lib\clang\15.0.3" -- "d:\Desktop\C\College\Vending Machine\Test.c"

Where are these flags, such as the TDM-GCC include paths and -nostdinc, coming from -- did you specify them in C:\Users\User\AppData\Local\clangd\config.yaml?

If so, you may want to try using --query-driver as described at https://clangd.llvm.org/troubleshooting#cant-find-standard-library-headers-map-stdioh-etc as an alternative to overriding the standard library include paths manually. (Note that using --query-driver requires you to have a compile_commands.json, see https://clangd.llvm.org/installation#project-setup for more about that.)

palapapa commented 1 year ago

I am using compile_flags.txt to set the -nostdinc flags etc. to override the headers because otherwise, clangd would always pick up the MSVC headers. And it's only a single file project so I thought using compile_commands.json would be an overkill.

HighCommander4 commented 1 year ago

And it's only a single file project so I thought using compile_commands.json would be an overkill.

Yeah, that's understandable. In clangd 16 you can use --query-driver without compile_commands.json, by setting the path of the compiler to be queried using the Compiler: key (under CompileFlags:) in the clangd config file. You can get a pre-release version of clangd 16 from the releases page (e.g. https://github.com/clangd/clangd/releases/tag/snapshot_20221127 is the current latest weekly snapshot), so that's an option to try.

Alternatively, if you use something like make to build your single file, you can generate a compile_commands.json using a tool such as https://github.com/nickdiego/compiledb.

One way or another, I would suggest trying --query-driver as the way to get clangd to use the TDM-GCC header paths, rather than specifying them manually.

QingyaoLin commented 1 year ago

The same problem occurs when I Ctrl-click a function to access the library.

I use clangd via the compile_command.json file generated by cmake.

// compile_command.json
[
{
  "directory": "C:/Users/xxx/source/repos/CLANG/HelloWorld/build",
  "command": "C:\\Users\\xxx\\scoop\\apps\\mingw-winlibs-llvm-ucrt\\current\\bin\\clang++.exe  -Wall -fcolor-diagnostics -g -std=c++17 -o CMakeFiles\\HelloWorld.dir\\main.cpp.obj -c C:\\Users\\xxx\\source\\repos\\CLANG\\HelloWorld\\main.cpp",
  "file": "C:\\Users\\xxx\\source\\repos\\CLANG\\HelloWorld\\main.cpp"
}
]

File contents for testing:

// main.cpp
#include <iostream>

int main(int argc, char **argv) {
  std::cout << "Hello,world!" << std::endl;

  return 1;
}

This is the relevant log information I checked:

I[16:14:27.019] --> textDocument/clangd.fileStatus
V[16:14:27.019] >>> {
  "jsonrpc": "2.0",
  "method": "textDocument/clangd.fileStatus",
  "params": {
    "state": "idle",
    "uri": "file:///c:/Users/xxx/scoop/apps/mingw-winlibs-llvm-ucrt/12.2.0-15.0.6-10.0.0-r3/include/c%2B%2B/12.2.0/ostream"
  }
}

[Error - 16:14:27] Request textDocument/codeAction failed.
[object Object]
V[16:14:27.978] <<< {
  "id": 30,
  "jsonrpc": "2.0",
  "method": "textDocument/semanticTokens/full/delta",
  "params": {
    "previousResultId": "1",
    "textDocument": {
      "uri": "file:///c%3A/Users/xxx/scoop/apps/mingw-winlibs-llvm-ucrt/12.2.0-15.0.6-10.0.0-r3/include/c%2B%2B/12.2.0/ostream"
    }
  }
}

I[16:14:27.978] <-- textDocument/semanticTokens/full/delta(30)
V[16:14:27.980] ASTWorker running SemanticHighlights on version 1 of c:/Users/xxx/scoop/apps/mingw-winlibs-llvm-ucrt/12.2.0-15.0.6-10.0.0-r3/include/c++/12.2.0/ostream
I[16:14:27.985] --> reply:textDocument/semanticTokens/full/delta(30) 6 ms
V[16:14:27.985] >>> {
  "id": 30,
  "jsonrpc": "2.0",
  "result": {
    "edits": [],
    "resultId": "2"
  }
}

I[16:14:27.985] --> textDocument/clangd.fileStatus
V[16:14:27.985] >>> {
  "jsonrpc": "2.0",
  "method": "textDocument/clangd.fileStatus",
  "params": {
    "state": "idle",
    "uri": "file:///c:/Users/xxx/scoop/apps/mingw-winlibs-llvm-ucrt/12.2.0-15.0.6-10.0.0-r3/include/c%2B%2B/12.2.0/ostream"
  }
}
HighCommander4 commented 1 year ago

The same problem occurs when I Ctrl-click a function to access the library.

The "Request XXX failed" errors in the linked screenshot don't seem to be related to this issue (which is about -Wformat), probably best to file a new issue for it.

palapapa commented 1 year ago

I recently changed from using TDM-GCC to mingw-w64 10.0.0 and this stopped happening. I wonder if that's related.