kbobyrev added a comment. The current version of the patch fixes one of the related issues. When running on a simple file like this
#include <iostream> int main() { std::cout << "Hello, world" << std::endl; return 0; } Clangd would fail to find `iostream` header and produce errors for `std::cout` and `std::endl` which are also not found before the patch. After the patch, this is no longer an issue. Hence, I believe that standard library headers can be identified correctly now. However, after the patch `wchar.h` from `#include_next` is not found and this produces another error. `wchar.h` there is AFAIK not a part of the standard library and should be found in the SDKROOT. The following is a log of Clangd failing to find `wchar.h`: kbobyrev$ ./bin/clangd -sync < /tmp/mirror clangd is a language server that provides IDE-like features to editors. It should be used via an editor plugin rather than invoked directly. For more information, see: https://clang.llvm.org/extra/clangd/ https://microsoft.github.io/language-server-protocol/ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable. I[11:18:01.774] clangd version 10.0.0 (https://github.com/llvm/llvm-project bd23859f390aa81ddb1bf0b16684cce50ad9d66d) I[11:18:01.775] PID: 92552 I[11:18:01.775] Working directory: /Users/kbobyrev/dev/build/llvm-release I[11:18:01.775] argv[0]: ./bin/clangd I[11:18:01.775] argv[1]: -sync I[11:18:01.775] Starting LSP over stdin/stdout I[11:18:01.776] <-- initialize(0) I[11:18:01.776] --> reply:initialize(0) 0 ms Content-Length: 800 {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"completionProvider":{"resolveProvider":false,"triggerCharacters":[".",">",":"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n","moreTriggerCharacter":[]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]},"hoverProvider":true,"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":2,"typeHierarchyProvider":true,"workspaceSymbolProvider":true}}}I[11:18:01.776] <-- textDocument/didOpen I[11:18:01.789] Failed to find compilation database for /private/tmp/test.cpp I[11:18:01.789] Updating file /private/tmp/test.cpp with command clangd fallback [/private/tmp] /Library/Developer/CommandLineTools/usr/bin/clang /private/tmp/test.cpp -fsyntax-only -resource-dir=/Users/kbobyrev/dev/build/llvm-release/lib/clang/10.0.0 I[11:18:02.155] --> textDocument/publishDiagnostics Content-Length: 819 {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"pp_file_not_found","message":"In included file: 'wchar.h' file not found","range":{"end":{"character":10,"line":0},"start":{"character":9,"line":0}},"relatedInformation":[{"location":{"range":{"end":{"character":23,"line":118},"start":{"character":14,"line":118}},"uri":"file:///Library/Developer/CommandLineTools/usr/include/c%2B%2B/v1/wchar.h"},"message":"Error occurred here"}],"severity":1,"source":"clang"},{"code":"typecheck_invalid_operands","message":"Invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char [13]')","range":{"end":{"character":13,"line":3},"start":{"character":11,"line":3}},"relatedInformation":[],"severity":1,"source":"clang"}],"uri":"file:///private/tmp/test.cpp"}}I[11:18:02.155] Warning: Missing Content-Length header, or zero-length message. E[11:18:02.155] Transport error: Input/output error I[11:18:02.155] LSP finished, exiting with status 1 This can be fixed manually by appending `env SDKROOT=$(xcrun --show-sdk-path)` to the clangd invocation (or simply defining the environment variable for all invocations), but I believe we might want to deal with it on the Clangd side, too. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70863/new/ https://reviews.llvm.org/D70863 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits