Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -8995,6 +8995,7 @@ def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
// Driver CAS options.
def fdepscan_EQ : Joined<["-"], "fdepscan=">,
Group<f_Group>,
Visibility<[ClangOption, CLOption]>,
HelpText<"Scan for dependencies ahead of compiling, generating a"
" pruned CAS tree to send to -fcas-fs. Values are"
" 'auto',"
Expand Down Expand Up @@ -9048,6 +9049,7 @@ def fdepscan_daemon_EQ : Joined<["-"], "fdepscan-daemon=">, Group<f_Group>,
" parent processes.">;

def fdepscan_include_tree : Flag<["-"], "fdepscan-include-tree">,
Visibility<[ClangOption, CLOption]>,
Group<f_Group>, HelpText<"Set dep-scanner to produce the include tree">;

// CAS prefix map options.
Expand Down
6 changes: 5 additions & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6362,7 +6362,11 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
// Output to a temporary file?
if ((!AtTopLevel && !isSaveTempsEnabled() &&
!C.getArgs().hasArg(options::OPT__SLASH_Fo)) ||
CCGenDiagnostics) {
CCGenDiagnostics ||
// Use a temp file for the depscan reponse file in CL mode
// (even with a /Fo flag).
(!AtTopLevel && isa<DepscanJobAction>(JA) &&
JA.getType() == types::TY_ResponseFile && IsCLMode())) {
StringRef Name = llvm::sys::path::filename(BaseInput);
std::pair<StringRef, StringRef> Split = Name.split('.');
const char *Suffix =
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4721,7 +4721,9 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
addDebugPrefixMapArg(D, TC, Args, CmdArgs);

// Add the output path to the object file for CodeView debug infos.
if (EmitCodeView && Output.isFilename())
// Skip this for temp depscan reponse file name.
if (EmitCodeView && Output.isFilename() &&
Output.getType() != types::TY_ResponseFile)
addDebugObjectName(Args, CmdArgs, DebugCompilationDir,
Output.getFilename());
}
Expand Down
17 changes: 17 additions & 0 deletions clang/test/ClangScanDeps/cas-clang-cl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// REQUIRES: ondisk_cas

// RUN: rm -rf %t
// RUN: split-file %s %t

// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-MISS
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-HIT

// In debug mode
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache /Z7 -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-MISS
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache /Z7 -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-HIT

// CACHE-HIT: remark: compile job cache hit
// CACHE-MISS: remark: compile job cache miss

//--- test.c
int main() { return 0; }