[clang] 2f300d3 - [clang][driver][wasm] Fix libstdc++ target-dependent include dir

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 05:43:40 PST 2022


Author: Timm Bäder
Date: 2022-02-23T14:38:34+01:00
New Revision: 2f300d34decba547dd07f5cd6034a6b2b2ca11a2

URL: https://github.com/llvm/llvm-project/commit/2f300d34decba547dd07f5cd6034a6b2b2ca11a2
DIFF: https://github.com/llvm/llvm-project/commit/2f300d34decba547dd07f5cd6034a6b2b2ca11a2.diff

LOG: [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

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/WebAssembly.cpp
    clang/test/Driver/wasm-toolchain.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp
index 292cf4d66971f..c5e4d569793c3 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 4a95860413dd9..3ff6a2cd53282 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"


        


More information about the cfe-commits mailing list