LLVM  10.0.0svn
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 
10 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/Support/Error.h"
16 #include <cassert>
17 
18 using namespace llvm;
19 using namespace llvm::codeview;
20 
22 
24  const DebugStringTableSubsectionRef &Strings)
25  : Strings(&Strings) {}
26 
28  const DebugStringTableSubsectionRef &Strings,
29  const DebugChecksumsSubsectionRef &Checksums)
30  : Strings(&Strings), Checksums(&Checksums) {}
31 
32 void StringsAndChecksumsRef::initializeStrings(
33  const DebugSubsectionRecord &SR) {
35  assert(!Strings && "Found a string table even though we already have one!");
36 
37  OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
38  consumeError(OwnedStrings->initialize(SR.getRecordData()));
39  Strings = OwnedStrings.get();
40 }
41 
43  resetStrings();
45 }
46 
48  OwnedStrings.reset();
49  Strings = nullptr;
50 }
51 
53  OwnedChecksums.reset();
54  Checksums = nullptr;
55 }
56 
58  const DebugStringTableSubsectionRef &StringsRef) {
59  OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
60  *OwnedStrings = StringsRef;
61  Strings = OwnedStrings.get();
62 }
63 
65  const DebugChecksumsSubsectionRef &CS) {
66  OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
67  *OwnedChecksums = CS;
68  Checksums = OwnedChecksums.get();
69 }
70 
71 void StringsAndChecksumsRef::initializeChecksums(
72  const DebugSubsectionRecord &FCR) {
74  if (Checksums)
75  return;
76 
77  OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
78  consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
79  Checksums = OwnedChecksums.get();
80 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void setChecksums(const DebugChecksumsSubsectionRef &CS)
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:981
Represents a read-only view of a CodeView string table.
void setStrings(const DebugStringTableSubsectionRef &Strings)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())