[clang] [Driver] Support using toolchain libc and libc++ for baremetal (PR #96736)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 08:47:40 PDT 2024


================
@@ -296,6 +300,47 @@ void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
     return;
 
   const Driver &D = getDriver();
+  std::string Target = getTripleString();
+
+  auto AddCXXIncludePath = [&](StringRef Path) {
+    std::string Version = detectLibcxxVersion(Path);
+    if (Version.empty())
+      return;
+
+    // First add the per-target multilib include dir.
+    if (!SelectedMultilibs.empty() && !SelectedMultilibs.back().isDefault()) {
+      const Multilib &M = SelectedMultilibs.back();
+      SmallString<128> TargetDir(Path);
+      llvm::sys::path::append(TargetDir, Target, M.gccSuffix(), "c++", Version);
----------------
nickdesaulniers wrote:

It might be helpful to add comments for what some of these paths look like when resolved.

https://github.com/llvm/llvm-project/pull/96736


More information about the cfe-commits mailing list