Skip to content

Commit 2238e67

Browse files
committed
Support NixOS resource dirs
Previously, CppInterOp assumed that the resource dir would end in the clang major version. This is common, but it's not always the case. On NixOS, for example, we have something like this: ``` ❯ clang++ -print-resource-dir /nix/store/xl0vlc2wdchfbq8536zs19pj2r3xdmma-clang-wrapper-19.1.5/resource-root ``` I have updated the function to check that the path contains the major version, rather than ending in it. This is still a useful version check, though it's not as precise as it was before.
1 parent e1ace51 commit 2238e67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Interpreter/CppInterOp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3042,7 +3042,7 @@ namespace Cpp {
30423042
CLANG_VERSION_MAJOR_STRING;
30433043
#endif
30443044
// We need to check if the detected resource directory is compatible.
3045-
if (llvm::sys::path::filename(detected_resource_dir) != version)
3045+
if (detected_resource_dir.find(version) == std::string::npos)
30463046
return "";
30473047

30483048
return detected_resource_dir;

0 commit comments

Comments
 (0)