From 2f300d34decba547dd07f5cd6034a6b2b2ca11a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 21 Feb 2022 16:01:13 +0100 Subject: [PATCH] [clang][driver][wasm] Fix libstdc++ target-dependent include dir The triple goes after the gcc version, not before. Also add the /backward version. Differential Revision: https://reviews.llvm.org/D120251 --- clang/lib/Driver/ToolChains/WebAssembly.cpp | 4 +++- clang/test/Driver/wasm-toolchain.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index 292cf4d66971..c5e4d569793c 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -528,10 +528,12 @@ void WebAssembly::addLibStdCXXIncludePaths( // First add the per-target include path if the OS is known. if (IsKnownOs) { - std::string TargetDir = LibPath + "/" + MultiarchTriple + "/c++/" + Version; + std::string TargetDir = LibPath + "/c++/" + Version + "/" + MultiarchTriple; addSystemInclude(DriverArgs, CC1Args, TargetDir); } // Second add the generic one. addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version); + // Third the backward one. + addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version + "/backward"); } diff --git a/clang/test/Driver/wasm-toolchain.cpp b/clang/test/Driver/wasm-toolchain.cpp index 4a95860413dd..3ff6a2cd5328 100644 --- a/clang/test/Driver/wasm-toolchain.cpp +++ b/clang/test/Driver/wasm-toolchain.cpp @@ -80,8 +80,9 @@ // COMPILE_STDCXX: clang{{.*}}" "-cc1" // COMPILE_STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]" // COMPILE_STDCXX: "-isysroot" "[[SYSROOT:[^"]+]]" -// COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi/c++/4.8" +// COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/wasm32-wasi" // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8" +// COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/c++/4.8/backward" // COMPILE_STDCXX: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include/wasm32-wasi" // COMPILE_STDCXX: "-internal-isystem" "[[SYSROOT:[^"]+]]/include"