[PATCH] D146794: [llvm-rc] Look for "clang-<major>" when locating a suitable preprocessor

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 01:04:01 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG282744a9ce18: [llvm-rc] Look for "clang-<major>" when locating a suitable preprocessor (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146794

Files:
  llvm/tools/llvm-rc/llvm-rc.cpp


Index: llvm/tools/llvm-rc/llvm-rc.cpp
===================================================================
--- llvm/tools/llvm-rc/llvm-rc.cpp
+++ llvm/tools/llvm-rc/llvm-rc.cpp
@@ -17,6 +17,7 @@
 #include "ResourceScriptStmt.h"
 #include "ResourceScriptToken.h"
 
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Object/WindowsResource.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
@@ -138,10 +139,12 @@
   StringRef Parent = llvm::sys::path::parent_path(Argv0);
   ErrorOr<std::string> Path = std::error_code();
   std::string TargetClang = (Triple + "-clang").str();
+  std::string VersionedClang = ("clang-" + Twine(LLVM_VERSION_MAJOR)).str();
   if (!Parent.empty()) {
     // First look for the tool with all potential names in the specific
     // directory of Argv0, if known
-    for (const auto *Name : {TargetClang.c_str(), "clang", "clang-cl"}) {
+    for (const auto *Name :
+         {TargetClang.c_str(), VersionedClang.c_str(), "clang", "clang-cl"}) {
       Path = sys::findProgramByName(Name, Parent);
       if (Path)
         return Path;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146794.508918.patch
Type: text/x-patch
Size: 1083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230328/452d2af3/attachment.bin>


More information about the llvm-commits mailing list