[PATCH] D117888: [clang][driver][wasm] Support -stdlib=libstdc++ for WebAssembly

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 1 02:14:04 PST 2022


tbaeder added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:448
+    addSystemInclude(DriverArgs, CC1Args,
+                     getDriver().SysRoot + "/include/c++/11");
+    break;
----------------
sbc100 wrote:
> tbaeder wrote:
> > sbc100 wrote:
> > > Where does `11` come from here?  Do other drivers hardcode this the same way?
> > `11` is just the current version. `lib/Driver/ToolChains/Gnu.cpp` figures out the correct version here via `GCCInstallationDetector`. I thought hard-coding is find for wasm because the `v1` for libc++ above is also hardcoded and `Gnu.cpp` figures that out dynamically as well (in `addLibCxxIncludePaths`).
> I'd rather not hardcode that current version, that seems rather fragile/wrong.
> 
> I agree the `v1` is probably also wrong (feel free to add a TODO or update that too).
> 
Updated both. They both  currently fall back to the old `v1`/`11`. I'm not sure how the test would otherwise work. As far as I know, the wasm sysroot will basically never contain an actual gcc installation, so `GCCInstallationDetector` can't be properly used. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117888/new/

https://reviews.llvm.org/D117888



More information about the cfe-commits mailing list