5959#if LLVM_ON_UNIX
6060#include < sys/file.h> // FIXME: Unix-only. Not portable.
6161#include < sys/signal.h> // FIXME: Unix-only. Not portable.
62+ #endif // LLVM_ON_UNIX
6263
6364#ifdef CLANG_HAVE_RLIMITS
6465#include < sys/resource.h>
6566#endif
6667
6768using namespace clang ;
6869using namespace llvm ::opt;
70+ #if LLVM_ON_UNIX
6971using cc1depscand::DepscanSharing;
72+ #endif // LLVM_ON_UNIX
7073using llvm::Error;
7174
7275#define DEBUG_TYPE " cc1depscand"
@@ -203,6 +206,7 @@ class SharedStream {
203206};
204207} // namespace
205208
209+ #ifdef LLVM_ON_UNIX
206210namespace {
207211// / FIXME: Move to LLVMSupport; probably llvm/Support/Process.h.
208212// /
@@ -354,6 +358,7 @@ makeDepscanDaemonPath(StringRef Mode, const DepscanSharing &Sharing) {
354358
355359 return std::nullopt ;
356360}
361+ #endif // LLVM_ON_UNIX
357362
358363static int
359364scanAndUpdateCC1Inline (const char *Exec, ArrayRef<const char *> InputArgs,
@@ -371,6 +376,7 @@ static Expected<llvm::cas::CASID> scanAndUpdateCC1InlineWithTool(
371376 SmallVectorImpl<const char *> &OutputArgs, llvm::cas::ObjectStore &DB,
372377 llvm::function_ref<const char *(const Twine &)> SaveArg);
373378
379+ #ifdef LLVM_ON_UNIX
374380static int scanAndUpdateCC1UsingDaemon (
375381 const char *Exec, ArrayRef<const char *> OldArgs,
376382 StringRef WorkingDirectory, SmallVectorImpl<const char *> &NewArgs,
@@ -432,6 +438,7 @@ static int scanAndUpdateCC1UsingDaemon(
432438
433439 return 0 ;
434440}
441+ #endif // LLVM_ON_UNIX
435442
436443// FIXME: This is a copy of Command::writeResponseFile. Command is too deeply
437444// tied with clang::Driver to use directly.
@@ -480,6 +487,7 @@ static int scanAndUpdateCC1(const char *Exec, ArrayRef<const char *> OldArgs,
480487 }
481488
482489 // Collect these before returning to ensure they're claimed.
490+ #ifdef LLVM_ON_UNIX
483491 DepscanSharing Sharing;
484492 if (Arg *A = Args.getLastArg (options::OPT_fdepscan_share_stop_EQ))
485493 Sharing.Stop = A->getValue ();
@@ -515,9 +523,11 @@ static int scanAndUpdateCC1(const char *Exec, ArrayRef<const char *> OldArgs,
515523 }
516524 }
517525
526+ #endif // LLVM_ON_UNIX
518527 bool ProduceIncludeTree = Args.hasArg (options::OPT_fdepscan_include_tree);
519528
520529 auto SaveArg = [&Args](const Twine &T) { return Args.MakeArgString (T); };
530+ #ifdef LLVM_ON_UNIX
521531 CompilerInvocation::GenerateCASArgs (CASOpts, Sharing.CASArgs , SaveArg);
522532 if (ProduceIncludeTree)
523533 Sharing.CASArgs .push_back (" -fdepscan-include-tree" );
@@ -526,6 +536,7 @@ static int scanAndUpdateCC1(const char *Exec, ArrayRef<const char *> OldArgs,
526536 return scanAndUpdateCC1UsingDaemon (Exec, OldArgs, WorkingDirectory, NewArgs,
527537 *DaemonPath, Sharing, Diag, SaveArg,
528538 CASOpts, RootID);
539+ #endif // LLVM_ON_UNIX
529540
530541 return scanAndUpdateCC1Inline (Exec, OldArgs, WorkingDirectory, NewArgs,
531542 ProduceIncludeTree, SaveArg, CASOpts, Diag,
@@ -626,6 +637,7 @@ int cc1depscan_main(ArrayRef<const char *> Argv, const char *Argv0,
626637 return 0 ;
627638}
628639
640+ #ifdef LLVM_ON_UNIX
629641namespace {
630642struct ScanServer {
631643 const char *Argv0 = nullptr ;
@@ -1079,6 +1091,7 @@ int ScanServer::listen() {
10791091
10801092 return 0 ;
10811093}
1094+ #endif // LLVM_ON_UNIX
10821095
10831096static Expected<llvm::cas::CASID> scanAndUpdateCC1InlineWithTool (
10841097 tooling::dependencies::DependencyScanningTool &Tool,
@@ -1151,4 +1164,3 @@ scanAndUpdateCC1Inline(const char *Exec, ArrayRef<const char *> InputArgs,
11511164
11521165 return DiagsConsumer->getNumErrors () != 0 ;
11531166}
1154- #endif /* LLVM_ON_UNIX */
0 commit comments