forked from pool/rstudio
64 lines
2.4 KiB
Diff
64 lines
2.4 KiB
Diff
From eea335f76f5d79bb2d3b24f5ee9c0c4819b11850 Mon Sep 17 00:00:00 2001
|
|
From: haem <mixosaurus+obs@pm.me>
|
|
Date: Fri, 12 Sep 2025 17:16:52 +0200
|
|
Subject: [PATCH 05/12] Fix libclang usage
|
|
|
|
Make sure we find the right libclang.so and builtin headers, make compatible with newer versions.
|
|
---
|
|
src/cpp/core/include/core/libclang/LibClang.hpp | 1 +
|
|
src/cpp/core/libclang/LibClang.cpp | 17 +++++++----------
|
|
2 files changed, 8 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/cpp/core/include/core/libclang/LibClang.hpp b/src/cpp/core/include/core/libclang/LibClang.hpp
|
|
index c7936ebb..d717f611 100644
|
|
--- a/src/cpp/core/include/core/libclang/LibClang.hpp
|
|
+++ b/src/cpp/core/include/core/libclang/LibClang.hpp
|
|
@@ -36,6 +36,7 @@
|
|
|
|
#include "clang-c/Index.h"
|
|
#include "clang-c/CXCompilationDatabase.h"
|
|
+#include "clang-c/Documentation.h"
|
|
|
|
namespace rstudio {
|
|
namespace core {
|
|
diff --git a/src/cpp/core/libclang/LibClang.cpp b/src/cpp/core/libclang/LibClang.cpp
|
|
index f166a43b..eed7f94b 100644
|
|
--- a/src/cpp/core/libclang/LibClang.cpp
|
|
+++ b/src/cpp/core/libclang/LibClang.cpp
|
|
@@ -62,12 +62,12 @@ std::vector<std::string> defaultCompileArgs(LibraryVersion version)
|
|
|
|
// we need to add in the associated libclang headers as
|
|
// they are not discovered / used by default during compilation
|
|
- FilePath llvmPath = s_libraryPath.getParent().getParent();
|
|
- boost::format fmt("%1%/lib/clang/%2%/include");
|
|
- fmt % llvmPath.getAbsolutePath() % version.asString();
|
|
+ FilePath llvmPath = s_libraryPath.getParent();
|
|
+ boost::format fmt("%1%/clang/%2%/include");
|
|
+ const std::string& versionStr = version.asString();
|
|
+ fmt % llvmPath.getAbsolutePath() % versionStr.substr(0, versionStr.find('.'));
|
|
std::string includePath = fmt.str();
|
|
- if (FilePath(includePath).exists())
|
|
- compileArgs.push_back(std::string("-I") + includePath);
|
|
+ compileArgs.push_back(std::string("-I") + includePath);
|
|
|
|
return compileArgs;
|
|
}
|
|
@@ -89,12 +89,9 @@ std::vector<std::string> systemClangVersions()
|
|
#elif defined(__unix__)
|
|
// default set of versions
|
|
clangVersions = {
|
|
- "/usr/lib/libclang.so",
|
|
- "/usr/lib/llvm/libclang.so",
|
|
- "/usr/lib64/libclang.so",
|
|
- "/usr/lib64/llvm/libclang.so",
|
|
+ "LIBCLANG_PLACEHOLDER",
|
|
};
|
|
-
|
|
+#elif 0
|
|
// iterate through the set of available 'llvm' directories
|
|
for (const char* prefix : {"/usr/lib", "/usr/lib64"})
|
|
{
|
|
--
|
|
2.51.0
|
|
|