LLVM  16.0.0git
StringsAndChecksums.cpp
Go to the documentation of this file.
1 //===- StringsAndChecksums.cpp --------------------------------------------===//
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 
14 #include "llvm/Support/Error.h"
15 #include <cassert>
16 
17 using namespace llvm;
18 using namespace llvm::codeview;
19 
21 
23  const DebugStringTableSubsectionRef &Strings)
24  : Strings(&Strings) {}
25 
27  const DebugStringTableSubsectionRef &Strings,
28  const DebugChecksumsSubsectionRef &Checksums)
29  : Strings(&Strings), Checksums(&Checksums) {}
30 
31 void StringsAndChecksumsRef::initializeStrings(
32  const DebugSubsectionRecord &SR) {
34  assert(!Strings && "Found a string table even though we already have one!");
35 
36  OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
37  consumeError(OwnedStrings->initialize(SR.getRecordData()));
38  Strings = OwnedStrings.get();
39 }
40 
42  resetStrings();
44 }
45 
47  OwnedStrings.reset();
48  Strings = nullptr;
49 }
50 
52  OwnedChecksums.reset();
53  Checksums = nullptr;
54 }
55 
57  const DebugStringTableSubsectionRef &StringsRef) {
58  OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
59  *OwnedStrings = StringsRef;
60  Strings = OwnedStrings.get();
61 }
62 
64  const DebugChecksumsSubsectionRef &CS) {
65  OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
66  *OwnedChecksums = CS;
67  Checksums = OwnedChecksums.get();
68 }
69 
70 void StringsAndChecksumsRef::initializeChecksums(
71  const DebugSubsectionRecord &FCR) {
73  if (Checksums)
74  return;
75 
76  OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
77  consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
78  Checksums = OwnedChecksums.get();
79 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Error.h
llvm::codeview::StringsAndChecksumsRef::setChecksums
void setChecksums(const DebugChecksumsSubsectionRef &CS)
Definition: StringsAndChecksums.cpp:63
llvm::codeview::DebugSubsectionKind::StringTable
@ StringTable
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1042
llvm::codeview::StringsAndChecksumsRef::resetChecksums
void resetChecksums()
Definition: StringsAndChecksums.cpp:51
DebugChecksumsSubsection.h
DebugSubsectionRecord.h
llvm::codeview::DebugSubsectionKind::FileChecksums
@ FileChecksums
llvm::codeview::StringsAndChecksumsRef::resetStrings
void resetStrings()
Definition: StringsAndChecksums.cpp:46
CodeView.h
llvm::codeview::StringsAndChecksumsRef::reset
void reset()
Definition: StringsAndChecksums.cpp:41
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::codeview::DebugSubsectionRecord
Definition: DebugSubsectionRecord.h:35
llvm::codeview::StringsAndChecksumsRef::StringsAndChecksumsRef
StringsAndChecksumsRef()
llvm::codeview::StringsAndChecksumsRef::setStrings
void setStrings(const DebugStringTableSubsectionRef &Strings)
Definition: StringsAndChecksums.cpp:56
llvm::codeview::DebugSubsectionRecord::kind
DebugSubsectionKind kind() const
Definition: DebugSubsectionRecord.cpp:47
StringsAndChecksums.h
DebugStringTableSubsection.h
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::DebugStringTableSubsectionRef
Represents a read-only view of a CodeView string table.
Definition: DebugStringTableSubsection.h:31
llvm::codeview::DebugSubsectionRecord::getRecordData
BinaryStreamRef getRecordData() const
Definition: DebugSubsectionRecord.cpp:49
llvm::codeview::DebugChecksumsSubsectionRef
Definition: DebugChecksumsSubsection.h:51