[PATCH] D138546: Clangd: Preserve target flags in system includes extractor

Aleksandr Platonov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 27 03:47:46 PST 2022


ArcsinX added a comment.

It seems this patch can break GCC toolchains support

This patch expects that we never get target-related options in `CommandLine` passed to `extractSystemIncludesAndTarget()` for **GCC** toolchain. But seems this is not always true because of https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp#L253

In other words, with this patch we preserve `--target=...`, but this option can appear from https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp#L253 (but not from `compile_commands.json`). As the result of it, we can call **GCC** toolchain with `--target=..` option at trying to query-driver and this call will fail (because GCC has no --target option)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138546/new/

https://reviews.llvm.org/D138546



More information about the cfe-commits mailing list