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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 18 23:15:59 PDT 2022


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



More information about the cfe-commits mailing list