Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Linker |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLD_COMMON_REPRODUCE_H |
| 11 | #define LLD_COMMON_REPRODUCE_H |
| 12 | |
| 13 | #include "lld/Common/LLVM.h" |
| 14 | #include "llvm/ADT/StringRef.h" |
| 15 | #include "llvm/Support/Error.h" |
| 16 | |
| 17 | namespace llvm { |
| 18 | namespace opt { class Arg; } |
| 19 | } |
| 20 | |
| 21 | namespace lld { |
| 22 | |
| 23 | // Makes a given pathname an absolute path first, and then remove |
| 24 | // beginning /. For example, "../foo.o" is converted to "home/john/foo.o", |
| 25 | // assuming that the current directory is "/home/john/bar". |
| 26 | std::string relativeToRoot(StringRef Path); |
| 27 | |
| 28 | // Quote a given string if it contains a space character. |
| 29 | std::string quote(StringRef S); |
| 30 | |
| 31 | // Rewrite the given path if a file exists with that pathname, otherwise |
| 32 | // returns the original path. |
| 33 | std::string rewritePath(StringRef S); |
| 34 | |
| 35 | // Returns the string form of the given argument. |
| 36 | std::string toString(const llvm::opt::Arg &Arg); |
| 37 | } |
| 38 | |
| 39 | #endif |