LLVM 22.0.0git
VirtualOutputConfig.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 OutputConfig class methods.
11///
12//===----------------------------------------------------------------------===//
13
15#include "llvm/Support/Debug.h"
18
19using namespace llvm;
20using namespace llvm::vfs;
21
23 // Ignore CRLF on its own as invalid.
24 using namespace llvm::sys::fs;
25 return Flags & OF_Text
26 ? setText().setCRLF(Flags & OF_CRLF).setAppend(Flags & OF_Append)
27 : setBinary().setAppend(Flags & OF_Append);
28}
29
31 OS << "{";
32 bool IsFirst = true;
33 auto printFlag = [&](StringRef FlagName, bool Value) {
34 if (IsFirst)
35 IsFirst = false;
36 else
37 OS << ",";
38 if (!Value)
39 OS << "No";
40 OS << FlagName;
41 };
42
43#define HANDLE_OUTPUT_CONFIG_FLAG(NAME, DEFAULT) \
44 if (get##NAME() != DEFAULT) \
45 printFlag(#NAME, get##NAME());
46#include "llvm/Support/VirtualOutputConfig.def"
47 OS << "}";
48}
49
51
53 Config.print(OS);
54 return OS;
55}
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:638
This file contains the declarations of the OutputConfig class.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
@ OF_Text
The file should be opened in text mode on platforms like z/OS that make this distinction.
Definition FileSystem.h:762
@ OF_CRLF
The file should use a carriage linefeed '\r '.
Definition FileSystem.h:766
@ OF_Append
The file should be opened in append mode.
Definition FileSystem.h:774
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Full configuration for an output for use by the OutputBackend.
constexpr OutputConfig & setBinary()
void print(raw_ostream &OS) const
OutputConfig & setOpenFlags(const sys::fs::OpenFlags &Flags)
Updates Text and CRLF flags based on sys::fs::OF_Text and sys::fs::OF_CRLF in Flags.