================ @@ -0,0 +1,48 @@ +//===------------------------------ Utils.h -------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Functions required by both the frontend and the module build daemon +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLING_MODULEBUILDDAEMON_UTILS_H +#define LLVM_CLANG_TOOLING_MODULEBUILDDAEMON_UTILS_H + +#include "llvm/Support/Error.h" + +#include <string> + +#ifdef _WIN32 +#include <afunix.h> +#else +#include <sys/un.h> +#endif + +namespace clang::tooling::cc1modbuildd { + +constexpr const std::string_view SOCKET_FILE_NAME = "mbd.sock"; +constexpr const std::string_view STDOUT_FILE_NAME = "mbd.out"; +constexpr const std::string_view STDERR_FILE_NAME = "mbd.err"; +constexpr const std::string_view MODULE_BUILD_DAEMON_FLAG = "-cc1modbuildd"; + +// A llvm::raw_socket_stream uses sockaddr_un +constexpr const size_t SOCKET_ADDR_MAX_LENGTH = sizeof(sockaddr_un::sun_path); + +constexpr const size_t BASEPATH_MAX_LENGTH = + SOCKET_ADDR_MAX_LENGTH - std::string_view(SOCKET_FILE_NAME).length(); ---------------- jansvoboda11 wrote:
Is constructing new `std::string_view` from `SOCKET_FILE_NAME` necessary? 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