1 //===- StringsAndChecksums.cpp ----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
11 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
12 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
13 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
16 using namespace llvm::codeview;
18 StringsAndChecksumsRef::StringsAndChecksumsRef() {}
20 StringsAndChecksumsRef::StringsAndChecksumsRef(
21 const DebugStringTableSubsectionRef &Strings)
22 : Strings(&Strings) {}
24 StringsAndChecksumsRef::StringsAndChecksumsRef(
25 const DebugStringTableSubsectionRef &Strings,
26 const DebugChecksumsSubsectionRef &Checksums)
27 : Strings(&Strings), Checksums(&Checksums) {}
29 void StringsAndChecksumsRef::initializeStrings(
30 const DebugSubsectionRecord &SR) {
31 assert(SR.kind() == DebugSubsectionKind::StringTable);
32 assert(!Strings && "Found a string table even though we already have one!");
34 OwnedStrings = llvm::make_unique<DebugStringTableSubsectionRef>();
35 consumeError(OwnedStrings->initialize(SR.getRecordData()));
36 Strings = OwnedStrings.get();
39 void StringsAndChecksumsRef::setChecksums(
40 const DebugChecksumsSubsectionRef &CS) {
41 OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
43 Checksums = OwnedChecksums.get();
46 void StringsAndChecksumsRef::initializeChecksums(
47 const DebugSubsectionRecord &FCR) {
48 assert(FCR.kind() == DebugSubsectionKind::FileChecksums);
52 OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>();
53 consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
54 Checksums = OwnedChecksums.get();