Coverage for /Syzygy/pdb/pdb_stream_record.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%880.C++source

Line-by-line coverage:

   1    :  // Copyright 2015 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #ifndef SYZYGY_PDB_PDB_STREAM_RECORD_H_
  16    :  #define SYZYGY_PDB_PDB_STREAM_RECORD_H_
  17    :  
  18    :  #include <cstdint>
  19    :  
  20    :  #include "base/logging.h"
  21    :  #include "base/strings/string16.h"
  22    :  #include "syzygy/common/assertions.h"
  23    :  #include "syzygy/pdb/pdb_stream.h"
  24    :  
  25    :  namespace pdb {
  26    :  
  27    :  class NumericConstant {
  28    :   public:
  29    :    enum Kind { CONSTANT_UNINITIALIZED, CONSTANT_UNSIGNED, CONSTANT_SIGNED };
  30    :  
  31    :    NumericConstant();
  32    :  
  33    :    // Acc
  34  E :    Kind kind() const { return kind_; }
  35  E :    uint64_t unsigned_value() const { return unsigned_value_; }
  36  E :    int64_t signed_value() const { return signed_value_; }
  37    :  
  38    :    // We need the function to set this constant for us.
  39    :    friend bool ReadNumericConstant(PdbStream* stream, NumericConstant* constant);
  40    :  
  41    :   private:
  42    :    union {
  43    :      uint64_t unsigned_value_;
  44    :      uint64_t signed_value_;
  45    :    };
  46    :  
  47    :    Kind kind_;
  48    :  };
  49    :  
  50    :  // Reads string from pdb stream and converts it into a wide string.
  51    :  // @param stream a pointer to the pdb stream.
  52    :  // @param string_field pointer to the wide string object.
  53    :  // @returns true on success, false on failure.
  54    :  bool ReadWideString(PdbStream* stream, base::string16* string_field);
  55    :  
  56    :  // Reads unsigned numeric leaf from pdb stream and stores it as 64-bit unsigned.
  57    :  // @param stream a pointer to the pdb stream.
  58    :  // @param data_field pointer to the numeric leaf object.
  59    :  // @returns true on success, false on failure.
  60    :  bool ReadUnsignedNumeric(PdbStream* stream, uint64_t* data_field);
  61    :  
  62    :  // Reads unsigned numeric leaf from pdb stream and stores it as 64-bit unsigned.
  63    :  // @param stream a pointer to the pdb stream.
  64    :  // @param constant pointer to the numeric constant object.
  65    :  // @returns true on success, false on failure.
  66    :  bool ReadNumericConstant(PdbStream* stream, NumericConstant* constant);
  67    :  
  68    :  // Reads basic type from pdb stream.
  69    :  // @param stream a pointer to the pdb stream.
  70    :  // @param basic_type a pointer to the destination object.
  71    :  // @returns true on success, false on failure.
  72    :  template <typename T>
  73  E :  bool ReadBasicType(PdbStream* stream, T* basic_type) {
  74    :    COMPILE_ASSERT_IS_POD(T);
  75  E :    DCHECK(stream);
  76  E :    DCHECK(basic_type);
  77    :  
  78  E :    return stream->Read(basic_type, 1);
  79  E :  }
  80    :  
  81    :  }  // namespace pdb
  82    :  
  83    :  #endif  // SYZYGY_PDB_PDB_STREAM_RECORD_H_

Coverage information generated Thu Jan 14 17:40:38 2016.