//===- Utils.h --------------------------------------------------*- 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 // //===----------------------------------------------------------------------===// #ifndef LLVM_DWARFLINKER_UTILS_H #define LLVM_DWARFLINKER_UTILS_H #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Error.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" namespace llvm { namespace dwarf_linker { /// This function calls \p Iteration() until it returns false. /// If number of iterations exceeds \p MaxCounter then an Error is returned. /// This function should be used for loops which assumed to have number of /// iterations significantly smaller than \p MaxCounter to avoid infinite /// looping in error cases. inline Error finiteLoop(function_ref<Expected<bool>()> Iteration, size_t MaxCounter = 100000) { … } /// Make a best effort to guess the /// Xcode.app/Contents/Developer path from an SDK path. inline StringRef guessDeveloperDir(StringRef SysRoot) { … } /// Make a best effort to determine whether Path is inside a toolchain. inline bool isInToolchainDir(StringRef Path) { … } inline bool isPathAbsoluteOnWindowsOrPosix(const Twine &Path) { … } } // end of namespace dwarf_linker } // end of namespace llvm #endif // LLVM_DWARFLINKER_UTILS_H