Skip to content

Commit 8fdcd16

Browse files
committed
[clang] Workaround issue with relative -fmodules-cache-path
1 parent cdf4efe commit 8fdcd16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SourceKit/Clang/ClangLanguageServer.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ extension ClangLanguageServerShim {
127127
"-Xclang", "-fmodule-format=raw"
128128
])
129129
}
130+
if let workingDirectory = settings.workingDirectory {
131+
// FIXME: this is a workaround for clangd not respecting the compilation
132+
// database's "directory" field for relative -fmodules-cache-path.
133+
// rdar://63984913
134+
settings.compilerArguments.append(contentsOf: [
135+
"-working-directory", workingDirectory
136+
])
137+
}
130138

131139
clangd.send(DidChangeConfigurationNotification(settings: .clangd(
132140
ClangWorkspaceSettings(

0 commit comments

Comments
 (0)