[llvm-branch-commits] [clang] [Clang][Driver] Add special-casing for including libc++ in C++03 (PR #83723)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Mar 3 04:51:39 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff b873847a53ae638e2146e3657fe33efe30c2afe1 a4b3917ae30620d3dd4fdb6b0fd92f7563314145 -- clang/include/clang/Driver/ToolChain.h clang/lib/Driver/ToolChain.cpp clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/BareMetal.cpp clang/lib/Driver/ToolChains/CrossWindows.cpp clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/Fuchsia.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Haiku.cpp clang/lib/Driver/ToolChains/Hexagon.cpp clang/lib/Driver/ToolChains/MinGW.cpp clang/lib/Driver/ToolChains/MipsLinux.cpp clang/lib/Driver/ToolChains/NaCl.cpp clang/lib/Driver/ToolChains/NetBSD.cpp clang/lib/Driver/ToolChains/OHOS.cpp clang/lib/Driver/ToolChains/OpenBSD.cpp clang/lib/Driver/ToolChains/WebAssembly.cpp clang/lib/Driver/ToolChains/ZOS.cpp clang/lib/Driver/ToolChains/ZOS.h clang/test/Driver/linux-header-search.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 1e94a53f8a..e35359faaa 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -40,9 +40,9 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/WithColor.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include "llvm/Support/WithColor.h"
 #include "llvm/TargetParser/AArch64TargetParser.h"
 #include "llvm/TargetParser/TargetParser.h"
 #include "llvm/TargetParser/Triple.h"
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 7358c2a121..7f13c0745d 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -743,8 +743,7 @@ void HexagonToolChain::addLibCxxIncludePaths(
     // FIXME: Is this actually expected? (Same below)
     addSystemInclude(DriverArgs, CC1Args,
                      D.SysRoot + "/usr/include/c++/v1/backward");
-  }
-  else if (getTriple().isMusl()) {
+  } else if (getTriple().isMusl()) {
     ToolChain::AddLibcxxInclude(DriverArgs, CC1Args, "/usr/include",
                                 IncludeStrategy::AssumeAvailable);
     addSystemInclude(DriverArgs, CC1Args, "/usr/include/c++/v1/backward");
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp
index f6ccde40b0..7508323906 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -494,10 +494,10 @@ void NetBSD::AddClangSystemIncludeArgs(
 void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
                                    llvm::opt::ArgStringList &CC1Args) const {
   const std::string Candidates[] = {
-    // directory relative to build tree
-    concat(getDriver().Dir, "/../include"),
-    // system install with full upstream path
-    concat(getDriver().SysRoot, "/usr/include"),
+      // directory relative to build tree
+      concat(getDriver().Dir, "/../include"),
+      // system install with full upstream path
+      concat(getDriver().SysRoot, "/usr/include"),
   };
 
   for (const auto &IncludePath : Candidates) {

``````````

</details>


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


More information about the llvm-branch-commits mailing list