This is an archive of the discontinued LLVM Phabricator instance.

docs: add some documentation on Windows SDK search
ClosedPublic

Authored by compnerd on Mar 15 2023, 1:17 PM.

Details

Summary

Add some documentation on the flags and the process by which clang
identifies the headers and libraries for the Windows environment. It
should identify the flags and their interactions as well as the order in
which the various sources of information are consulted.

Diff Detail

Event Timeline

compnerd created this revision.Mar 15 2023, 1:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 1:17 PM
compnerd requested review of this revision.Mar 15 2023, 1:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 1:17 PM

Looks reasonable I guess - but I think it would be good to mention the env variables INCLUDE and LIB too, for alternative ways of finding the same things - even if it's not strictly the same as what this new section talks about.

hans added a comment.Mar 16 2023, 12:50 PM

Nice, thanks for doing this!

clang/docs/UsersManual.rst
4537

But isn't this how clang-cl finds stuff when running in a "Visual Studio Command Prompt" / setenv / vcvars or whatever it's called these days?

I think this would be the most common case for people building from the command line, and I'd suggest perhaps starting the list with this one (I realize they're currently sorted by precedence, but sorting by most common first would also be valid I think).

Looks reasonable I guess - but I think it would be good to mention the env variables INCLUDE and LIB too, for alternative ways of finding the same things - even if it's not strictly the same as what this new section talks about.

Yes, I agree, I did miss that in this. I don't think that the point is entirely correct though, because Include does impact the WinSDK lookup. That means that it is reflective of what the section is talking about. LIB belongs in both I believe as that impacts the lookup for the libraries for both the SDK and Visual C++ tools (for VC Runtime). Basically, I think that your point is more important than what you were attributing to it and this needs to be further refined for precision.

clang/docs/UsersManual.rst
4537

But isn't this how clang-cl finds stuff when running in a "Visual Studio Command Prompt" / setenv / vcvars or whatever it's called these days?

No, it isn't, because this is the Windows SDK portion. The environment variable is for the Visual C++ tools only, the environment based SDK lookup is unimplemented.

Something something complexity something.

This is part of why I structured this the way as I have. There are two parts of the lookup here, the part dealing with the SDK and the part dealing with the VC++ tools. Now, it could be argued that this is finer point of detail that most will not care about, and I am concerned that is very much true, but the reality is that there is a bunch of complexity in the lookup and the value in documenting the behaviour is that we can easily lookup how to control the behaviour of the driver.

I think this would be the most common case for people building from the command line, and I'd suggest perhaps starting the list with this one (I realize they're currently sorted by precedence, but sorting by most common first would also be valid I think).

I think that common behaviour should be listed in prose. If someone has more than one mechanism in the command line, the resulting behaviour would not match the written one and that can lead to confusion.

hans accepted this revision.Mar 20 2023, 7:42 AM
hans added inline comments.
clang/docs/UsersManual.rst
4504

Optionally, If you wanted to be ultra pedagogical, this paragraph could perhaps list an example library/header as part of explaining the SDK, UCRT, and tools.

4537

No, it isn't, because this is the Windows SDK portion.

Oh, I see. I clearly missed that detail :)

I think that common behaviour should be listed in prose.

Fair enough.

This revision is now accepted and ready to land.Mar 20 2023, 7:42 AM
compnerd marked an inline comment as not done.Mar 20 2023, 5:05 PM
compnerd added inline comments.
clang/docs/UsersManual.rst
4504

I like this idea, I'll update this.

compnerd updated this revision to Diff 506978.Mar 21 2023, 7:46 AM

Update to include additional behaviour and reference INCLUDE and LIB.

hans added a comment.Mar 21 2023, 8:30 AM

Nice, thanks for taking the time to expand on this!

This revision was automatically updated to reflect the committed changes.