[clangd-dev] Supporting gcc environments with clangd

Ilya Biryukov via clangd-dev clangd-dev at lists.llvm.org
Thu Jan 10 09:12:33 PST 2019

Hi Doug,

I'm pretty new to the LLVM project so I'm not sure how best to proceed.
Welcome! Happy to have you on board!

We are working on using clangd in the Eclipse CDT context (which is now
> also building VS Code extensions) where we mainly support developers
> building embedded systems. Most of these systems use gcc as the compiler
> and where clang does not have target support.
> I've been able to get clangd to properly deal with these projects by
> forking llmv and clang and adding Triples and Toolchains to properly set up
> the system include paths and built-in macros and other properties clang
> needs to parse.
I also have a hack in the clangd layer to figure out the '-target' argument
> from the gcc command and inject it when fetching from the compilation
> database. This part is especially ugly and I'm hoping to find a better way.
How do you figure it out currently? If the fork is public, could you
provide the pointers to the code? My initial intuition is that it would
make sense for this to live somewhere in the Tooling library (which defines
abstractions for compile_commands.json), would also enable things like
clang-tidy for those use-cases.

The main question I have: is there appetite for changes like this to be
> pushed upstream, even though these targets are not meant to be used by
> clang itself? Or is a fork the proper way to deal with this? Is there
> anyone else doing something similar?
+via cfe-dev <cfe-dev at lists.llvm.org> for figuring out whether it's fine to
have targets supported only in the frontend without the prospect of them
being implemented in the backend.
>From the clangd's standpoint (and more generally, from other source-level
tools like clang-tidy, etc.) this would make total sense: if clang can run
for some targets only with `-fsyntax-only` (producing an error in the modes
that need the codegen), all the source-level tools can still be used there.

> Thanks!
> Doug.
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev

Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190110/5a8e17f2/attachment.html>

More information about the clangd-dev mailing list