https://github.com/pdagobert created https://github.com/llvm/llvm-project/pull/88201
Fixes https://github.com/llvm/llvm-project/issues/87304 >From 6db0e01e198de9e5ee4055f9433150818c429c10 Mon Sep 17 00:00:00 2001 From: pdagobert <pdagob...@users.noreply.github.com> Date: Tue, 9 Apr 2024 23:10:58 +0200 Subject: [PATCH] Fix coverage when /fo is used --- clang/lib/Driver/ToolChains/Clang.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 766a9b91e3c0ad..44d18acd25a589 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -802,6 +802,10 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, } else if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo)) { CoverageFilename = FinalOutput->getValue(); + StringRef V = FinalOutput->getValue(); + if (llvm::sys::path::is_separator(V.back())) { + CoverageFilename += llvm::sys::path::filename(Output.getBaseInput()); + } } else if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o)) { CoverageFilename = FinalOutput->getValue(); } else { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits