Skip to content

Commit c3993d6

Browse files
author
git apple-llvm automerger
committed
Merge commit 'bff2aa636247' from llvm.org/main into next
2 parents 066b9e8 + bff2aa6 commit c3993d6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,10 +2542,14 @@ bool Driver::HandleImmediateArgs(Compilation &C) {
25422542
}
25432543

25442544
if (C.getArgs().hasArg(options::OPT_print_runtime_dir)) {
2545-
if (std::optional<std::string> RuntimePath = TC.getRuntimePath())
2546-
llvm::outs() << *RuntimePath << '\n';
2547-
else
2548-
llvm::outs() << TC.getCompilerRTPath() << '\n';
2545+
for (auto RuntimePath :
2546+
{TC.getRuntimePath(), std::make_optional(TC.getCompilerRTPath())}) {
2547+
if (RuntimePath && getVFS().exists(*RuntimePath)) {
2548+
llvm::outs() << *RuntimePath << '\n';
2549+
return false;
2550+
}
2551+
}
2552+
llvm::outs() << "(runtime dir is not present)" << '\n';
25492553
return false;
25502554
}
25512555

0 commit comments

Comments
 (0)