Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 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 | // Rewrite the given path if a file exists with that pathname, otherwise |
| 31 | // returns the original path. |
| 32 | std::string rewritePath(StringRef S); |
| 33 | |
| 34 | // Returns the string form of the given argument. |
| 35 | std::string toString(const llvm::opt::Arg &Arg); |
| 36 | } |
| 37 | |
| 38 | #endif |