LLVM  5.0.0
StringsAndChecksums.cpp
Go to the documentation of this file.
1 //===- StringsAndChecksums.cpp --------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/Support/Error.h"
17 #include <cassert>
18 
19 using namespace llvm;
20 using namespace llvm::codeview;
21 
23 
25  const DebugStringTableSubsectionRef &Strings)
26  : Strings(&Strings) {}
27 
29  const DebugStringTableSubsectionRef &Strings,
30  const DebugChecksumsSubsectionRef &Checksums)
31  : Strings(&Strings), Checksums(&Checksums) {}
32 
33 void StringsAndChecksumsRef::initializeStrings(
34  const DebugSubsectionRecord &SR) {
36  assert(!Strings && "Found a string table even though we already have one!");
37 
38  OwnedStrings = llvm::make_unique<DebugStringTableSubsectionRef>();
39  consumeError(OwnedStrings->initialize(SR.getRecordData()));
40  Strings = OwnedStrings.get();
41 }
42 
44  const DebugChecksumsSubsectionRef &CS) {
45  OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
46  *OwnedChecksums = CS;
47  Checksums = OwnedChecksums.get();
48 }
49 
50 void StringsAndChecksumsRef::initializeChecksums(
51  const DebugSubsectionRecord &FCR) {
53  if (Checksums)
54  return;
55 
56  OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
57  consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
58  Checksums = OwnedChecksums.get();
59 }
void setChecksums(const DebugChecksumsSubsectionRef &CS)
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:593
Represents a read-only view of a CodeView string table.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())