1 //===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLD_COMMON_REPRODUCE_H 10 #define LLD_COMMON_REPRODUCE_H 11 12 #include "lld/Common/LLVM.h" 13 #include "llvm/ADT/StringRef.h" 14 #include "llvm/Support/Error.h" 15 16 namespace llvm { 17 namespace opt { class Arg; } 18 } 19 20 namespace lld { 21 22 // Makes a given pathname an absolute path first, and then remove 23 // beginning /. For example, "../foo.o" is converted to "home/john/foo.o", 24 // assuming that the current directory is "/home/john/bar". 25 std::string relativeToRoot(StringRef path); 26 27 // Quote a given string if it contains a space character. 28 std::string quote(StringRef s); 29 30 // Returns the string form of the given argument. 31 std::string toString(const llvm::opt::Arg &arg); 32 } 33 34 #endif 35