Comment #3 on pull request 1244 by kimgr: Identify libcxx from clang ToolChain
https://github.com/include-what-you-use/include-what-you-use/pull/1244
My head is itching on the inside, but I think I've figured out a way to do it. I'm not convinced it's better, but I think it turns all the arrows in a forward direction:
* `IwyuAction::CreateASTConsumer` currently calls `InitGlobals`
* But just above is the innocuous comment `// Do this first thing after getting our hands on a CompilerInstance`
* That's not really in `CreateASTConsumer`, that's actually in `iwyu_driver.cc`, `CreateCompilerInstance`
* `CreateCompilerInstance` also has access to the `Compilation`, which exposes `getDefaultToolChain`, and lets us get to the `CXXStdlibType` enum.
* So presumably we could call `InitGlobals` from `CreateCompilerInstance` and pass both compiler and toolchain, depending on what we need.
I think that makes sense. Not sure if there are drawbacks to calling `InitGlobals` from outside the action, but I don't think so. Feels better, even. I'll try to materialize a path when I get some time, unless you beat me to it :)