[cfe-dev] clangd, completion in header files
Duncan P. N. Exon Smith via cfe-dev
cfe-dev at lists.llvm.org
Fri Mar 30 12:03:39 PDT 2018
I think warning that we don't know the right compile flags is a great idea.
> On Mar 30, 2018, at 11:47, Sam McCall <sammccall at google.com> wrote:
>
> That's a good point. Somehow I forgot obj-c++ was a thing... We should switch this.
>
> One silly downside though - I find just "-x c++" won't actually give useful results on real projects.
> Does this match others' experience?
> The "Unknown type name 'namespace'" error I tend to get from the current behavior is at least predictable and recognizable. If we were parsing as obj-c++ but missing other flags, problems could be more subtle.
>
> But we could of course do even better here - if the CDB could report when a command is fallback/inferred, clangd could insert a warning at the first line of the file. "No compile flags found, using 'clang -x objective-c++'" or so.
>
> What do you think?
>
> On Fri, Mar 30, 2018, 18:55 Duncan P. N. Exon Smith <dexonsmith at apple.com <mailto:dexonsmith at apple.com>> wrote:
>
> > On Mar 26, 2018, at 01:22, Sam McCall via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> >
> > When there's no compile command provided, we fall back to 'clang $filename'. Clang treats .h files as C.
>
> I wonder if, as a fallback, `clang -x objective-c++ $filename` would be more generally useful... it puts Clang into "accept almost everything" mode. This is the mode LLDB uses for expression evaluation IIRC.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180330/7c812033/attachment.html>
More information about the cfe-dev
mailing list