[clang][bytecode] Fix reporting failed local constexpr initializers (#123588)
[llvm-project.git] / llvm / lib / Support / ModRef.cpp
blobd3b3dd11171f16d28013bc109744a7e6079b1d55
1 //===--- ModRef.cpp - Memory effect modeling --------------------*- 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 // This file implements ModRef and MemoryEffects misc functions.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/Support/ModRef.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/ADT/StringExtras.h"
17 using namespace llvm;
19 raw_ostream &llvm::operator<<(raw_ostream &OS, ModRefInfo MR) {
20 switch (MR) {
21 case ModRefInfo::NoModRef:
22 OS << "NoModRef";
23 break;
24 case ModRefInfo::Ref:
25 OS << "Ref";
26 break;
27 case ModRefInfo::Mod:
28 OS << "Mod";
29 break;
30 case ModRefInfo::ModRef:
31 OS << "ModRef";
32 break;
34 return OS;
37 raw_ostream &llvm::operator<<(raw_ostream &OS, MemoryEffects ME) {
38 interleaveComma(MemoryEffects::locations(), OS, [&](IRMemLocation Loc) {
39 switch (Loc) {
40 case IRMemLocation::ArgMem:
41 OS << "ArgMem: ";
42 break;
43 case IRMemLocation::InaccessibleMem:
44 OS << "InaccessibleMem: ";
45 break;
46 case IRMemLocation::Other:
47 OS << "Other: ";
48 break;
50 OS << ME.getModRef(Loc);
51 });
52 return OS;
55 raw_ostream &llvm::operator<<(raw_ostream &OS, CaptureComponents CC) {
56 if (capturesNothing(CC)) {
57 OS << "none";
58 return OS;
61 ListSeparator LS;
62 if (capturesAddressIsNullOnly(CC))
63 OS << LS << "address_is_null";
64 else if (capturesAddress(CC))
65 OS << LS << "address";
66 if (capturesReadProvenanceOnly(CC))
67 OS << LS << "read_provenance";
68 if (capturesFullProvenance(CC))
69 OS << LS << "provenance";
71 return OS;
74 raw_ostream &llvm::operator<<(raw_ostream &OS, CaptureInfo CI) {
75 ListSeparator LS;
76 CaptureComponents Other = CI.getOtherComponents();
77 CaptureComponents Ret = CI.getRetComponents();
79 OS << "captures(";
80 if (!capturesNothing(Other) || Other == Ret)
81 OS << LS << Other;
82 if (Other != Ret)
83 OS << LS << "ret: " << Ret;
84 OS << ")";
85 return OS;