CIRCT
20.0.0git
Loading...
Searching...
No Matches
lib
Support
Path.cpp
Go to the documentation of this file.
1
//===- Path.cpp - 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
#include "
circt/Support/Path.h
"
15
#include "llvm/Support/Path.h"
16
17
using namespace
circt
;
18
19
/// Append a path to an existing path, replacing it if the other path is
20
/// absolute. This mimicks the behaviour of `foo/bar` and `/foo/bar` being used
21
/// in a working directory `/home`, resulting in `/home/foo/bar` and `/foo/bar`,
22
/// respectively.
23
void
circt::appendPossiblyAbsolutePath
(llvm::SmallVectorImpl<char> &base,
24
const
llvm::Twine &suffix) {
25
if
(llvm::sys::path::is_absolute(suffix)) {
26
base.clear();
27
suffix.toVector(base);
28
}
else
{
29
llvm::sys::path::append(base, suffix);
30
}
31
}
Path.h
circt
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition
DebugAnalysis.h:21
circt::appendPossiblyAbsolutePath
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:23
Generated on Thu Jan 23 2025 00:07:33 for CIRCT by
1.9.8