================ @@ -0,0 +1,285 @@ +//===------- cc1modbuildd_main.cpp - Clang CC1 Module Build Daemon --------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/Tooling/ModuleBuildDaemon/SocketSupport.h" +#include "clang/Tooling/ModuleBuildDaemon/Utils.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/ThreadPool.h" + +#include <csignal> +#include <cstdbool> +#include <fstream> +#include <optional> +#include <string> +#include <system_error> + +#ifdef _WIN32 +#include <windows.h> +#else +#include <unistd.h> +#endif + +using namespace llvm; +using namespace clang::tooling::cc1modbuildd; + +// Create unbuffered STDOUT stream so that any logging done by the module build +// daemon can be viewed without having to terminate the process +static raw_fd_ostream &unbuff_outs() { + static raw_fd_ostream S(fileno(stdout), false, true); + return S; +} + +static bool VerboseLog = false; +static void verboseLog(const llvm::Twine &message) { + if (VerboseLog) { + unbuff_outs() << message << '\n'; + } +} + +static void setupSignals(sighandler_t handler) { ---------------- Bigcheese wrote:
`sighandler_t` isn't portable as the std doesn't define a name for the signal handler type. You should be able to use `decltype(SIG_DFL)` to define your own type. https://github.com/llvm/llvm-project/pull/67562 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits