<div dir="ltr">Hi Kai, in addition to what Theodore suggested;<div><br></div><div>if you are compiling your project with a custom toolchain, you might wanna take a look at --query-driver option, described in <a href="https://clang.llvm.org/extra/clangd/Configuration.html#id2" class="cremed">https://clang.llvm.org/extra/clangd/Configuration.html#id2</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 10, 2020 at 8:55 PM Theodore Dubois via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org">clangd-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I use clangd with -target flags in compile_commands.json. You could<br>
also see if your Hexagon clang includes a clangd binary of its own.<br>
<br>
~Theodore<br>
<br>
On Mon, Feb 10, 2020 at 9:36 AM Kai Ting via clangd-dev<br>
<<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> Is there a way to pass a compile target flag to clangd? I primarily work with code cross-compiled using the Hexagon clang tool chain. The vanilla clang on my host PC generates a lot of errors for inline ASM code (e.g "unknown register name 'r0' in asm"). I noticed that I can pass "-ferror-limit=0" in compile_commands.json so that the number of diagnostics can exceed the default 20. This makes make wonder whether I can just tell clangd the target architecture. I tried but it seems architecture flags are ignored by clangd.<br>
><br>
> I verified that the official LLVM 9 binary can generate Hexgon code - e.g.  "clang -target hexagon -c test.c" generates a valid .o output with hexagon assembly.  So it seems not far fetched that one can make clangd support various registered targets of llvm. If this is possible and not implemented, I'd like to contribute.<br>
><br>
> Before migrating to clangd, I have been using libclang based plugin YouCompleteMe. This works out well for my purpose since I can switch libclang used by YCM with libclang from the Hexagon tool chain. Unfortunately, this is not possible with clangd.<br>
><br>
> Thanks for the great work!<br>
><br>
> -Kai<br>
><br>
><br>
> _______________________________________________<br>
> clangd-dev mailing list<br>
> <a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
_______________________________________________<br>
clangd-dev mailing list<br>
<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
</blockquote></div>