LCOV - code coverage report
Current view: top level - lib/DebugInfo/CodeView - StringsAndChecksums.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 22 38 57.9 %
Date: 2017-09-14 15:23:50 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           6 : StringsAndChecksumsRef::StringsAndChecksumsRef(
      29             :     const DebugStringTableSubsectionRef &Strings,
      30           6 :     const DebugChecksumsSubsectionRef &Checksums)
      31          18 :     : Strings(&Strings), Checksums(&Checksums) {}
      32             : 
      33           2 : 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           6 :   OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
      39           8 :   consumeError(OwnedStrings->initialize(SR.getRecordData()));
      40           2 :   Strings = OwnedStrings.get();
      41           2 : }
      42             : 
      43           0 : void StringsAndChecksumsRef::reset() {
      44           0 :   resetStrings();
      45           0 :   resetChecksums();
      46           0 : }
      47             : 
      48           0 : void StringsAndChecksumsRef::resetStrings() {
      49           0 :   OwnedStrings.reset();
      50           0 :   Strings = nullptr;
      51           0 : }
      52             : 
      53         253 : void StringsAndChecksumsRef::resetChecksums() {
      54         506 :   OwnedChecksums.reset();
      55         253 :   Checksums = nullptr;
      56         253 : }
      57             : 
      58          30 : void StringsAndChecksumsRef::setStrings(
      59             :     const DebugStringTableSubsectionRef &StringsRef) {
      60          90 :   OwnedStrings = std::make_shared<DebugStringTableSubsectionRef>();
      61          90 :   *OwnedStrings = StringsRef;
      62          30 :   Strings = OwnedStrings.get();
      63          30 : }
      64             : 
      65           0 : void StringsAndChecksumsRef::setChecksums(
      66             :     const DebugChecksumsSubsectionRef &CS) {
      67           0 :   OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
      68           0 :   *OwnedChecksums = CS;
      69           0 :   Checksums = OwnedChecksums.get();
      70           0 : }
      71             : 
      72         163 : void StringsAndChecksumsRef::initializeChecksums(
      73             :     const DebugSubsectionRecord &FCR) {
      74             :   assert(FCR.kind() == DebugSubsectionKind::FileChecksums);
      75         163 :   if (Checksums)
      76             :     return;
      77             : 
      78         489 :   OwnedChecksums = std::make_shared<DebugChecksumsSubsectionRef>();
      79         652 :   consumeError(OwnedChecksums->initialize(FCR.getRecordData()));
      80         163 :   Checksums = OwnedChecksums.get();
      81             : }

Generated by: LCOV version 1.13