<div dir="auto">For simple projects, you can create a file "compile_flags.txt" in the project root, with one arg on each line.<div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif"><a href="https://clangd.github.io/installation.html">https://clangd.github.io/installation.html</a></span><br></div><div dir="auto"><br></div><div dir="auto">clangd will parse files with the command "clang $FLAGS $FILE".</div><div dir="auto">This database isn't enumerable though, so you won't get background indexing.</div><div dir="auto"><br></div><div dir="auto">Does this help?<br><div dir="auto">Other approaches are also possible, but not implemented, happy to discuss</div><div dir="auto"><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 8, 2019, 5:45 PM Sam Lunt 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As far as I can tell, there doesn't seem to be a method to pass<br>
default arguments for clangd to use when there is no compilation<br>
database found or when no suitable entry for a given file can be found<br>
in the database.<br>
<br>
This is a bit inconvenient when writing short throw-away programs<br>
(i.e. that don't require a Makefile or CMakeLists), especially since<br>
the default C++ standard used is C++14, which leads to warnings about<br>
new syntax. I was wondering how difficult it would be to support<br>
passing some default arguments when clangd is started, e.g.:<br>
    clangd -- -Wall -Wextra -Wpedantic -std=c++17<br>
<br>
One issue with this is that it would possibly cause problems, since<br>
when a C file was passed, it would see a flag "-std=c++17". However,<br>
one solution could be to use the "-x" flag to set language specific<br>
flags:<br>
    clangd -- -Wall -x c -std=gnu99 -x c++ -std=c++17<br>
<br>
That would lead to C files using the flags "-Wall -std=gnu99", while<br>
C++ files would use the flags "-Wall -std=c++17". (Note that before<br>
the first "-x" flag, all flags apply to every language).<br>
<br>
Would this feature be feasible to add?<br>
_______________________________________________<br>
clangd-dev mailing list<br>
<a href="mailto:clangd-dev@lists.llvm.org" target="_blank" rel="noreferrer">clangd-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
</blockquote></div>