[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-09 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked 2 inline comments as done.
tbaeder added inline comments.



Comment at: clang/unittests/Driver/ToolChainTest.cpp:647
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);

ebevhan wrote:
> There's a binary name missing here:
> 
> ```
> {"clang", "--gcc-toolchain="}
> ```
> 
> Driver strips the first argument, so the behavior of this test becomes 
> dependent on GCC_INSTALL_PREFIX which can cause it to fail in some cases.
Thanks, I pushed a commit adding the driver name.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-09 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added a comment.

Hi! This test is failing in some of our downstream builds.




Comment at: clang/unittests/Driver/ToolChainTest.cpp:647
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);

There's a binary name missing here:

```
{"clang", "--gcc-toolchain="}
```

Driver strips the first argument, so the behavior of this test becomes 
dependent on GCC_INSTALL_PREFIX which can cause it to fail in some cases.



Comment at: clang/unittests/Driver/ToolChainTest.cpp:687
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);

Here too.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-08 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added subscribers: quinnp, nemanjai.
nemanjai added a comment.

The original toolchain detection added `root/usr` to the paths which was 
certainly necessary on PowerPC. Since that suffix is removed in this patch, our 
Redhat buildbot is now broken 
(https://lab.llvm.org/buildbot/#/builders/57/builds/18577). @quinnp has posted 
an update to this at https://reviews.llvm.org/D127310.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-02 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 433673.

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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -18,6 +18,7 @@
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/Host.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
@@ -610,4 +611,94 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+  // Ignore this test on Windows hosts.
+  llvm::Triple Host(llvm::sys::getProcessTriple());
+  if (Host.isOSWindows())
+GTEST_SKIP();
+
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+
+  // Check (newer) GCC toolset installation.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored.
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored.
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2130,17 +2130,31 @@
   // and gcc-toolsets.
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux &&
   D.getVFS().exists("/opt/rh")) {
-Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
-

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-02 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked 2 inline comments as done.
tbaeder added inline comments.



Comment at: clang/unittests/Driver/ToolChainTest.cpp:623
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+

MaskRay wrote:
> delete `public`.
> 
> Can you avoid using a derived DiagnosticConsumer?
I can use the `SimpleDiagnosticConsumer` class created earlier in the file.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D125862#3552465 , @tbaeder wrote:

> Ping. @MaskRay Can you take a quick look and check if this is what you had in 
> mind?

LG




Comment at: clang/unittests/Driver/ToolChainTest.cpp:615
+TEST(ToolChainTest, Toolsets) {
+
+  // Ignore this test on Windows hosts.

delete blank line



Comment at: clang/unittests/Driver/ToolChainTest.cpp:623
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+

delete `public`.

Can you avoid using a derived DiagnosticConsumer?



Comment at: clang/unittests/Driver/ToolChainTest.cpp:698
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');

This should be removed if we exclude Windows.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-06-01 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment.

Ping. @MaskRay Can you take a quick look and check if this is what you had in 
mind?


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-25 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 431928.
tbaeder added a comment.

@MaskRay Ignored the new test on Windows hosts now like you suggested. Does 
this look good?


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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -18,6 +18,7 @@
 #include "clang/Driver/Driver.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/Host.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
@@ -610,4 +611,100 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+
+  // Ignore this test on Windows hosts.
+  llvm::Triple Host(llvm::sys::getProcessTriple());
+  if (Host.isOSWindows())
+GTEST_SKIP();
+
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+
+  // Check (newer) GCC toolset installation.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored.
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored.
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-24 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment.

In D125862#3532630 , @MaskRay wrote:

>> Harbormaster completed remote builds in `B165047: Diff 430277.`
>
> You can get Windows bot results in the link.

Hm, the windows pre-merge checks don't fail. Just the buildbots. I wonder if 
the `BuildCompilation()` calls simply have the wrong parameters. The other 
calls in the file seem to always create a fake `foo.cpp` even if they only 
check the verbose info.

Also not great that `printVerboseInfo()` seems to print nothing in case of an 
error :/


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-24 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 431609.

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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -610,4 +610,94 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+
+  // Check (newer) GCC toolset installation
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(
+TheDriver.BuildCompilation({"--gcc-toolchain="}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2130,17 +2130,31 @@
   // and gcc-toolsets.
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux &&
   D.getVFS().exists("/opt/rh")) {
-Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
-Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
-Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
-Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
-

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Because of `TargetTriple.getOS() == llvm::Triple::Linux`, you need to guard the 
unittest under a similar check.

> Harbormaster completed remote builds in `B165047: Diff 430277.`

You can get Windows bot results in the link.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-23 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8717b492dfcd: [clang][driver] Dynamically select 
gcc-toolset/devtoolset version (authored by tbaeder).

Changed prior to commit:
  https://reviews.llvm.org/D125862?vs=430597=431314#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -610,4 +610,92 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+
+  // Check (newer) GCC toolset installation.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset.
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection.
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2130,17 +2130,31 @@
   // and gcc-toolsets.
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux 

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-19 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: StephenFan.

Thanks!




Comment at: clang/unittests/Driver/ToolChainTest.cpp:618
+
+  // Check (newer) GCC toolset installation
+  {

End full sentences with a period `.`


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 430597.
tbaeder marked 4 inline comments as done.

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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -610,4 +610,92 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+
+  // Check (newer) GCC toolset installation
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+// These should be ignored
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2151,17 +2151,31 @@
   // and gcc-toolsets.
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux &&
   D.getVFS().exists("/opt/rh")) {
-Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
-Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
-Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
-Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
-

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-19 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2164
+  StringRef ToolsetDir = llvm::sys::path::filename(LI->path());
+
+  if (!ToolsetDir.startswith("gcc-toolset-") &&

delete blank line



Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2170
+  unsigned ToolsetVersion;
+  if (ToolsetDir.substr(ToolsetDir.rfind('-') + 1)
+  .getAsInteger(10, ToolsetVersion))

The two `if` can be combined



Comment at: clang/unittests/Driver/ToolChainTest.cpp:623
+
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));

Add a comment that these directories are ignored.



Comment at: clang/unittests/Driver/ToolChainTest.cpp:650
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-512/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "

512 is arbitrary. It's good to test something close to the real.


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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 430572.
Herald added a subscriber: ormris.

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

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/ToolChainTest.cpp

Index: clang/unittests/Driver/ToolChainTest.cpp
===
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -610,4 +610,90 @@
   DiagConsumer->clear();
 }
 
+TEST(ToolChainTest, Toolsets) {
+  IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
+  struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+
+  // Check (newer) GCC toolset installation
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/gcc-toolset-512/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/gcc-toolset-512/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/gcc-toolset-512/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+
+  // And older devtoolset
+  {
+IntrusiveRefCntPtr InMemoryFileSystem(
+new llvm::vfs::InMemoryFileSystem);
+
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+// File needed for GCC installation detection
+InMemoryFileSystem->addFile(
+"/opt/rh/devtoolset-512/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0,
+llvm::MemoryBuffer::getMemBuffer("\n"));
+
+DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
+ "clang LLVM compiler", InMemoryFileSystem);
+std::unique_ptr C(TheDriver.BuildCompilation({"-v"}));
+ASSERT_TRUE(C);
+std::string S;
+{
+  llvm::raw_string_ostream OS(S);
+  C->getDefaultToolChain().printVerboseInfo(OS);
+}
+if (is_style_windows(llvm::sys::path::Style::native))
+  std::replace(S.begin(), S.end(), '\\', '/');
+EXPECT_EQ("Found candidate GCC installation: "
+  "/opt/rh/devtoolset-512/lib/gcc/x86_64-redhat-linux/11\n"
+  "Selected GCC installation: "
+  "/opt/rh/devtoolset-512/lib/gcc/x86_64-redhat-linux/11\n"
+  "Candidate multilib: .;@m64\n"
+  "Selected multilib: .;@m64\n",
+  S);
+  }
+}
+
 } // end anonymous namespace.
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2150,17 +2150,35 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL/CentOS devtoolsets and gcc-toolsets.
-Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
-Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
-Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
-

[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In addition, if every new GCC release requires addition to 
/opt/rh/gcc-toolset-$major (if I understand correctly), we probably want to 
switch to `llvm::vfs::directory_iterator` iteration and using the largest 
version.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

It may be time to add unittests to `clang/unittests/Driver/ToolChainTest.cpp` 
for /opt/rh detection. You may use `TEST(ToolChainTest, VFSGCCInstallation)` as 
an example creating a pseudo file hierarchy in memory.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: tstellar, phosek.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

This makes it possible to use the newest gcc-toolset/devtoolset on RHEL.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125862

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2150,8 +2150,10 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL/CentOS devtoolsets and gcc-toolsets.
+Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
+Prefixes.push_back("/opt/rh/devtoolset-12/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2150,8 +2150,10 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL/CentOS devtoolsets and gcc-toolsets.
+Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
+Prefixes.push_back("/opt/rh/devtoolset-12/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits