1. Make resource dir unique and global.

2. Use our custom CDB loader.
This commit is contained in:
ykiko
2024-12-10 16:15:50 +08:00
parent f9bff085b2
commit c082458fb1
16 changed files with 332 additions and 194 deletions

View File

@@ -7,10 +7,31 @@
namespace clice {
namespace vfs = llvm::vfs;
namespace fs = llvm::sys::fs;
namespace path = llvm::sys::path;
namespace fs {
using namespace llvm::sys::fs;
inline std::string resource_dir = "";
inline llvm::Error init_resource_dir(llvm::StringRef execute) {
llvm::SmallString<128> path;
path::append(path, path::parent_path(execute), "..");
path::append(path, "lib", "clang", "20");
if(auto error = real_path(path, path)) {
return llvm::make_error<llvm::StringError>(error.message(), error);
}
resource_dir = path.str();
return llvm::Error::success();
}
} // namespace fs
namespace vfs = llvm::vfs;
class ThreadSafeFS : public vfs::ProxyFileSystem {
public:
explicit ThreadSafeFS() : ProxyFileSystem(vfs::createPhysicalFileSystem()) {}