//===-- Process.cpp - Implement OS Process Concept --------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// // // This file implements the operating system Process concept. // //===----------------------------------------------------------------------===// #include "llvm/Support/Process.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Config/config.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/CrashRecoveryContext.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" #include <optional> #include <stdlib.h> // for _Exit usingnamespacellvm; usingnamespacesys; //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only TRULY operating system //=== independent code. //===----------------------------------------------------------------------===// std::optional<std::string> Process::FindInEnvPath(StringRef EnvName, StringRef FileName, char Separator) { … } std::optional<std::string> Process::FindInEnvPath(StringRef EnvName, StringRef FileName, ArrayRef<std::string> IgnoreList, char Separator) { … } // clang-format off #define COLOR(FGBG, CODE, BOLD) … #define ALLCOLORS(FGBG, BRIGHT, BOLD) … // bg // | bold // | | // | | codes // | | | // | | | static const char colorcodes[2][2][16][11] = …; // clang-format on // A CMake option controls wheter we emit core dumps by default. An application // may disable core dumps by calling Process::PreventCoreFiles(). static bool coreFilesPrevented = …; bool Process::AreCoreFilesPrevented() { … } [[noreturn]] void Process::Exit(int RetCode, bool NoCleanup) { … } // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX #include "Unix/Process.inc" #endif #ifdef _WIN32 #include "Windows/Process.inc" #endif