Loading [MathJax]/extensions/tex2jax.js
CIRCT 22.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Path.h
Go to the documentation of this file.
1//===- Path.h - Path Utilities ----------------------------------*- 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// Utilities for file system path handling, supplementing the ones from
10// llvm::sys::path.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CIRCT_SUPPORT_PATH_H
15#define CIRCT_SUPPORT_PATH_H
16
17#include "circt/Support/LLVM.h"
18#include "llvm/Support/ToolOutputFile.h"
19
20namespace circt {
21
22/// Append a path to an existing path, replacing it if the other path is
23/// absolute. This mimicks the behaviour of `foo/bar` and `/foo/bar` being used
24/// in a working directory `/home`, resulting in `/home/foo/bar` and `/foo/bar`,
25/// respectively.
26void appendPossiblyAbsolutePath(llvm::SmallVectorImpl<char> &base,
27 const llvm::Twine &suffix);
28
29/// Creates an output file with the given filename in the specified directory.
30/// The function will create any parent directories as needed. If an error
31/// occurs during file or directory creation, it will use the provided emitError
32/// callback to report the error and return an empty unique_ptr.
33std::unique_ptr<llvm::ToolOutputFile>
34createOutputFile(StringRef filename, StringRef dirname,
35 function_ref<InFlightDiagnostic()> emitError);
36
37} // namespace circt
38
39#endif // CIRCT_SUPPORT_PATH_H
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
std::unique_ptr< llvm::ToolOutputFile > createOutputFile(StringRef filename, StringRef dirname, function_ref< InFlightDiagnostic()> emitError)
Creates an output file with the given filename in the specified directory.
Definition Path.cpp:37
void appendPossiblyAbsolutePath(llvm::SmallVectorImpl< char > &base, const llvm::Twine &suffix)
Append a path to an existing path, replacing it if the other path is absolute.
Definition Path.cpp:26