quinnp updated this revision to Diff 435914.
quinnp added a comment.
Herald added a subscriber: ormris.

Addressing review comments. Removing path without `/root/usr` prefix and 
changing unit test to match.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127310

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
@@ -587,9 +587,9 @@
                                 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"));
+    InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-12/root/usr/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,
@@ -603,9 +603,9 @@
       C->getDefaultToolChain().printVerboseInfo(OS);
     }
     EXPECT_EQ("Found candidate GCC installation: "
-              "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              
"/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Selected GCC installation: "
-              "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              
"/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Candidate multilib: .;@m64\n"
               "Selected multilib: .;@m64\n",
               S);
@@ -627,9 +627,9 @@
                                 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"));
+    InMemoryFileSystem->addFile("/opt/rh/devtoolset-12/root/usr/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,
@@ -643,9 +643,9 @@
       C->getDefaultToolChain().printVerboseInfo(OS);
     }
     EXPECT_EQ("Found candidate GCC installation: "
-              "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Selected GCC installation: "
-              "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Candidate multilib: .;@m64\n"
               "Selected multilib: .;@m64\n",
               S);
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2154,7 +2154,7 @@
     }
 
     if (ChosenToolsetVersion > 0)
-      Prefixes.push_back(ChosenToolsetDir);
+      Prefixes.push_back(ChosenToolsetDir + "/root/usr");
   }
 
   // Fall back to /usr which is used by most non-Solaris systems.


Index: clang/unittests/Driver/ToolChainTest.cpp
===================================================================
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -587,9 +587,9 @@
                                 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"));
+    InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-12/root/usr/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,
@@ -603,9 +603,9 @@
       C->getDefaultToolChain().printVerboseInfo(OS);
     }
     EXPECT_EQ("Found candidate GCC installation: "
-              "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Selected GCC installation: "
-              "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Candidate multilib: .;@m64\n"
               "Selected multilib: .;@m64\n",
               S);
@@ -627,9 +627,9 @@
                                 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"));
+    InMemoryFileSystem->addFile("/opt/rh/devtoolset-12/root/usr/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,
@@ -643,9 +643,9 @@
       C->getDefaultToolChain().printVerboseInfo(OS);
     }
     EXPECT_EQ("Found candidate GCC installation: "
-              "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Selected GCC installation: "
-              "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n"
+              "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
               "Candidate multilib: .;@m64\n"
               "Selected multilib: .;@m64\n",
               S);
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2154,7 +2154,7 @@
     }
 
     if (ChosenToolsetVersion > 0)
-      Prefixes.push_back(ChosenToolsetDir);
+      Prefixes.push_back(ChosenToolsetDir + "/root/usr");
   }
 
   // Fall back to /usr which is used by most non-Solaris systems.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to