-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include compile_flags.txt in installed header directory #45348
Comments
Sorry, I combined compile_commands.json with compile_flags.txt. I meant the latter since that seems like the simpler solution than building a full compiledb listing flags for each header. OTOH, using a compiledb might be nice for headers that are only valid with specific flags, like TS language support headers. I fixed the title, but couldn't edit my initial description comment. |
This is problematic, because it has the possibility of colliding with a user-provided file named 'compile_commands.json' and having it be included inadvertently (since the libc++ include directory is on every user's include path). Yeah, it's unlikely. |
(Sorry for finding this so late) @mclow Regarding putting the file on the include path, can we put it in the parent directory instead? I don't know about the general case (or much about libc++), but on my system |
The main problem I actually see is that the compile_flags.txt file would most likely not correctly represent the flags that the user is using when compiling, and a such it would be misleading (at least to some extent). What exactly should go into compile_flags.txt? |
I think this would work well:
I think As you point out it's not perfect, but it avoids the biggest practical issues:
Our experience is that the value of having tools/features work on headers seems to outweigh the occasional confusion caused by picking the wrong configuration. |
(I've tested that locally and it indeed helps a lot) |
@sam-mccall that is roughly what I was thinking, but is probably a better version. I would personally suggest |
Regarding passing |
Extended Description
Having a compile_commands.txt file that includes at least -stdlib=libc++ significantly improves the experience when using clangd and navigating to one of the libc++ headers on platforms where libc++ is not the default stdlib. It may also be worth setting -std=c++LATEST so that the maximum amount of code is parsed and usable, but that is less important than not having every file broken due to mixing stdlib headers.
The text was updated successfully, but these errors were encountered: