blob: ac7a822cf2a5ad20ef2ea6619965747277525787 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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 Scull5e1ddfa2018-08-14 10:06:54 +01006//
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
16namespace llvm {
17namespace opt { class Arg; }
18}
19
20namespace 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".
25std::string relativeToRoot(StringRef Path);
26
27// Quote a given string if it contains a space character.
28std::string quote(StringRef S);
29
30// Rewrite the given path if a file exists with that pathname, otherwise
31// returns the original path.
32std::string rewritePath(StringRef S);
33
34// Returns the string form of the given argument.
35std::string toString(const llvm::opt::Arg &Arg);
36}
37
38#endif