LLVM 22.0.0git
VirtualOutputBackend.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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/// \file
10/// This file implements \c vfs::OutputBackend class methods.
11///
12//===----------------------------------------------------------------------===//
13
17
18using namespace llvm;
19using namespace llvm::vfs;
20
21void OutputBackend::anchor() {}
22
23Expected<OutputFile>
25 std::optional<OutputConfig> Config) {
26 SmallString<128> PathStorage;
27 Path.toVector(PathStorage);
28
29 if (Config) {
30 // Check for invalid configs.
31 if (!Config->getText() && Config->getCRLF())
32 return make_error<OutputConfigError>(*Config, PathStorage);
33 }
34
35 std::unique_ptr<OutputFileImpl> Impl;
36 if (Error E = createFileImpl(PathStorage, Config).moveInto(Impl))
37 return std::move(E);
38 assert(Impl && "Expected valid Impl or Error");
39 return OutputFile(PathStorage, std::move(Impl));
40}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallString class.
This file contains the declarations of the VirtualOutputBackend class, which can be used to virtualiz...
This file contains the declarations of the OutputError class.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
virtual Expected< std::unique_ptr< OutputFileImpl > > createFileImpl(StringRef Path, std::optional< OutputConfig > Config)=0
Create a file for Path.
Expected< OutputFile > createFile(const Twine &Path, std::optional< OutputConfig > Config=std::nullopt)
Create a file.
A virtualized output file that writes to a specific backend.
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340