LCOV - code coverage report
Current view: top level - lib/DebugInfo/CodeView - StringsAndChecksums.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 20 34 58.8 %
Date: 2018-10-20 13:21:21 Functions: 5 9 55.6 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
      11             : #include "llvm/ADT/STLExtras.h"
      12             : #include "llvm/DebugInfo/CodeView/CodeView.h"
      13             : #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
      14             : #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
      15             : #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
      16             : #include "llvm/Support/Error.h"
      17             : #include <cassert>
      18             : 
      19             : using namespace llvm;
      20             : using namespace llvm::codeview;
      21             : 
      22             : StringsAndChecksumsRef::StringsAndChecksumsRef() = default;
      23             : 
      24           0 : StringsAndChecksumsRef::StringsAndChecksumsRef(
      25           0 :     const DebugStringTableSubsectionRef &Strings)
      26           0 :     : Strings(&Strings) {}
      27             : 
      28          10 : StringsAndChecksumsRef::StringsAndChecksumsRef(
      29             :     const DebugStringTableSubsectionRef &Strings,
      30          10 :     const DebugChecksumsSubsectionRef &Checksums)
      31          10 :     : Strings(&Strings), Checksums(&Checksums) {}
      32             : 
      33           7 : void StringsAndChecksumsRef::initializeStrings(
      34             :     const DebugSubsectionRecord &SR) {
      35             :   assert(SR.kind() == DebugSubsectionKind::StringTable);
      36             :   assert(!Strings && "Found a string table even though we already have one!");
      37             : 
      38           7 :   OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
      39          14 :   consumeError(OwnedStrings->initialize(SR.getRecordData()));
      40           7 :   Strings = OwnedStrings.get();
      41           7 : }
      42             : 
      43           0 : void StringsAndChecksumsRef::reset() {
      44           0 :   resetStrings();
      45           0 :   resetChecksums();
      46           0 : }
      47             : 
      48           0 : void StringsAndChecksumsRef::resetStrings() {
      49             :   OwnedStrings.reset();
      50           0 :   Strings = nullptr;
      51           0 : }
      52             : 
      53         260 : void StringsAndChecksumsRef::resetChecksums() {
      54             :   OwnedChecksums.reset();
      55         260 :   Checksums = nullptr;
      56         260 : }
      57             : 
      58          33 : void StringsAndChecksumsRef::setStrings(
      59             :     const DebugStringTableSubsectionRef &StringsRef) {
      60          33 :   OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
      61             :   *OwnedStrings = StringsRef;
      62          33 :   Strings = OwnedStrings.get();
      63          33 : }
      64             : 
      65           0 : void StringsAndChecksumsRef::setChecksums(
      66             :     const DebugChecksumsSubsectionRef &CS) {
      67           0 :   OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
      68             :   *OwnedChecksums = CS;
      69           0 :   Checksums = OwnedChecksums.get();
      70           0 : }
      71             : 
      72         174 : void StringsAndChecksumsRef::initializeChecksums(
      73             :     const DebugSubsectionRecord &FCR) {
      74             :   assert(FCR.kind() == DebugSubsectionKind::FileChecksums);
      75         174 :   if (Checksums)
      76             :     return;
      77             : 
      78         174 :   OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
      79         348 :   consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
      80         174 :   Checksums = OwnedChecksums.get();
      81             : }

Generated by: LCOV version 1.13