blob: 734d9e4011d199a55f0ee97e8765ae0a5cb52fd3 [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".
Andrew Walbran3d2c1972020-04-07 12:24:26 +010025std::string relativeToRoot(StringRef path);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010026
27// Quote a given string if it contains a space character.
Andrew Walbran3d2c1972020-04-07 12:24:26 +010028std::string quote(StringRef s);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010029
30// Returns the string form of the given argument.
Andrew Walbran3d2c1972020-04-07 12:24:26 +010031std::string toString(const llvm::opt::Arg &arg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010032}
33
34#endif