Skip to content

Commit 9cf482e

Browse files
committed
Pass through file-compilation-dir to the ClangImporter.
This change passes through the -file-compilation-dir flag to the ClangImporter instance as -ffile-compilation-dir. When used in conjunction with llvm/llvm-project#67744 this will allow for setting the compilation directory of pcm files using the -file-compilation-dir flag.
1 parent 204d496 commit 9cf482e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,13 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
15441544
Opts.ExtraArgs.push_back("-fdebug-prefix-map=" + Val);
15451545
}
15461546

1547+
if (auto *A = Args.getLastArg(OPT_file_compilation_dir)) {
1548+
// Forward the -file-compilation-dir flag to correctly set the
1549+
// debug compilation directory.
1550+
std::string Val(A->getValue());
1551+
Opts.ExtraArgs.push_back("-ffile-compilation-dir=" + Val);
1552+
}
1553+
15471554
if (FrontendOpts.CASFSRootIDs.empty() &&
15481555
FrontendOpts.ClangIncludeTrees.empty()) {
15491556
if (!workingDirectory.empty()) {

0 commit comments

Comments
 (0)